I'm trying to get this assembly code program to compare three integers and return the largest variable, I believe this code should work however my print is giving me integers 6 and 9. The three variables are set to be 3, 6, and 9 in ASCII
Here's my code:
section .data
str: db 'Hello world!', 0Ah
var1: dw 51 
var2: dw 54
var3: dw 57
result: dw 00h
section .text
global _start
_start:
       mov eax, dword [var1]
       mov ebx, dword [var2]
       cmp eax, ebx
       jge nextstate
       mov dword [result], ebx
       jmp print
nextstate:
       mov eax, dword [var1]
       mov ebx, dword [var3]
       cmp eax, ebx
       jge finalstate
       mov dword [result], ebx
finalstate:
       mov dword [result], eax
print:
       mov eax, 4
       mov ebx, 1
       mov ecx, result
       mov edx, 13
       int 80h
       mov eax, 1
       mov ebx, 0
       int 80h
 
    