```shell ┌──(kali㉿kali)-[~/code] └─$ wget https://artifacts.picoctf.net/c/511/disassembler-dump0_d.txt --2023-07-30 23:35:20-- https://artifacts.picoctf.net/c/511/disassembler-dump0_d.txt Resolving artifacts.picoctf.net (artifacts.picoctf.net)... 13.35.7.96, 13.35.7.121, 13.35.7.31, ... Connecting to artifacts.picoctf.net (artifacts.picoctf.net)|13.35.7.96|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 482 [application/octet-stream] Saving to: ‘disassembler-dump0_d.txt’ disassembler-dump0_d.txt 100%[=================================================================>] 482 --.-KB/s in 0s 2023-07-30 23:35:23 (9.87 MB/s) - ‘disassembler-dump0_d.txt’ saved [482/482] ┌──(kali㉿kali)-[~/code] └─$ cat disassembler-dump0_d.txt <+0>: endbr64 <+4>: push rbp <+5>: mov rbp,rsp <+8>: mov DWORD PTR [rbp-0x14],edi <+11>: mov QWORD PTR [rbp-0x20],rsi <+15>: mov DWORD PTR [rbp-0x4],0x9fe1a <+22>: cmp DWORD PTR [rbp-0x4],0x2710 <+29>: jle 0x55555555514e <main+37> <+31>: sub DWORD PTR [rbp-0x4],0x65 <+35>: jmp 0x555555555152 <main+41> <+37>: add DWORD PTR [rbp-0x4],0x65 <+41>: mov eax,DWORD PTR [rbp-0x4] <+44>: pop rbp <+45>: ret ┌──(kali㉿kali)-[~/code] └─$ python3 Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> 0x9fe1a 654874 >>> 0x2710 10000 >>> 0x9fe1a-0x65 654773 ``` ## study materials:`cmp` & `jle` The x86 assembly uses a system of bit-flags that represent the result of comparisons. The conditional jump instructions use these flags when deciding whether to perform the jump or not. In your case you'd use the following two instructions: ``` cmp ebx, 10 ; compare EBX and 10 jle label ; jump if EBX is "less than or equal" to 10 … label: … ``` Here is a simple example of an if/else that stores to one of two different locations, depending on ebx <= 10. The mov store instructions are the if and else blocks. ``` .model small .code start : mov ebx , 20 ( we insert 20 in ebx ) CMP ebx , 10 ( we compare 20 with 10 ) JBE there ( Jump if below or equal to there ) mov [1020h] , ebx ( else we move ebx to [1020h] ) JMP exit ; don't fall into the else part there: mov [1030h] , ebx ( If ebx <= 10 we move ebx to [1030h] ) ;JMP exit ; redundant: execution falls through to exit on its own exit: ( define a label that other instructions can jump to) mov ax, 4c00h int 21h ; 16-bit DOS exit system call end start ``` (source: https://stackoverflow.com/questions/4557279/assembly-jle-jmp-instruction-example)