#classroom #assignment #homework

Conditional branches control which code path executes based on flags set by cmp or other arithmetic instructions. This assignment focuses on interpreting branch conditions correctly, including the common mistake of reversing the jump logic.

Study this snippet from encrypt_func:

.text:00414693 cmp     [ebp+enable_xor], 0
.text:00414697 mov     [ebp+var_8], ecx
.text:0041469A mov     [ebp+var_1], bl
.text:0041469D mov     [ebp+var_2], bl
.text:004146A0 mov     [ebp+plaintext_buffer_length], esi
.text:004146A3 jz      short loc_4146B6

.text:004146A5 enabled_xor:
.text:004146A5 call    _rand
.text:004146AA mov     bh, al
.text:004146AC cmp     bh, 64h
.text:004146AF jb      short enabled_xor

.text:004146B1 ; fall-through continues here

.text:004146B6 loc_4146B6:
.text:004146B6 mov     bh, 63h

Determine the exact conditions under which each branch is taken and how to translate the assembly into readable pseudocode or C.