;jumping.asm - Exploring Conditional Jumps extern printf ; declare the external function printf section .data number1 dq 42 ; defining a variable number1 with the value 42 number2 dq 41 ; defining a variable number2 with the value 41 fmt1 db "NUMBER1 >= NUMBER2", 10,0 ; format string for comparison result 1 fmt2 db "NUMBER1 < NUMBER2",10,0 ; format string for comparison result 2 section .text global main main: push rbp ;save the base pointer mov rbp, rsp ; set up the base pointer mov rax, [number1] ; load the value of number1 into register RAX mov rbx, [number2] ; load the vlaue of number2 into register RBX cmp rax, rbx ; using CMP for cmparing the values in rax and rbx jge greater ; Jumpt to 'greater' if rax >= rbx mov rdi, fmt2 ; loading the format string for the secont message mov rax, 0 ; clearing rax, no xmm registers involved call printf ; Call porintf to display "NUMBER1 < NUMBER2" jmp exit ; jump to the exit lable greater: mov rdi, fmt1 ; load thje format string for the first message mov rax, 0 ; clear the RAX again call printf ; Call printf to display "NUMBER1 >= NUMBER2" exit: mov rsp, rbp ; restoring the stack pointer pop rbp ; restoring the base pointer ret ; return from the main function