def __fix_reil_flag(self, reil_context, x86_context, flag):
        reil_context_out = dict(reil_context)

        flags_reg = 'eflags' if 'eflags' in reil_context_out else 'rflags'

        _, bit = self.arch_info.alias_mapper[flag]

        # Clean flag.
        reil_context_out[flags_reg] &= ~(2**bit) & (2**32-1)

        # Copy flag.
        reil_context_out[flags_reg] |= (x86_context[flags_reg] & 2**bit)

        return reil_context_out
dataset/ETHPy150Open programa-stic/barf-project/barf/tests/arch/x86/test_x86translator.py/X86TranslationTests.__fix_reil_flag/original