section .data
prompt1 db "Key in the first number : ", 0
prompt2 db "Key in the second number : ", 0
result1 db "The total is ", 0
result2 db "The division result is ", 0
result3 db "The remainder value is ", 0
newline db 10, 0
section .bss
num1 resb 2
num2 resb 2
section .text
global _start
_start:
mov eax, 4
mov ebx, 1
mov ecx, prompt1
mov edx, 23
int 0x80
mov eax, 3
mov ebx, 0
mov ecx, num1
mov edx, 2
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, prompt2
mov edx, 24
int 0x80
mov eax, 3
mov ebx, 0
mov ecx, num2
mov edx, 2
int 0x80
mov al, [num1]
sub al, '0'
mov [num1], al
mov al, [num2]
sub al, '0'
mov [num2], al
mov al, [num1]
mul byte [num2]
mov [num1], al
mov eax, 4
mov ebx, 1
mov ecx, result1
mov edx, 13
int 0x80
mov al, [num1]
add al, '0'
mov [num1], al
mov ecx, num1
mov edx, 1
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, newline
mov edx, 1
int 0x80
mov al, [num1]
div byte [num2]
mov [num1], al
mov eax, 4
mov ebx, 1
mov ecx, result2
mov edx, 16
int 0x80
mov al, [num1]
add al, '0'
mov [num1], al
mov ecx, num1
mov edx, 1
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, newline
mov edx, 1
int 0x80
mov al, [num1]
mov ah, 0
div byte [num2]
mov [num1], ah
mov eax, 4
mov ebx, 1
mov ecx, result3
mov edx, 17
int 0x80
mov al, [num1]
add al, '0'
mov [num1], al
mov ecx, num1
mov edx, 1
int 0x80
mov eax, 4
mov ebx, 1
mov ecx, newline
mov edx, 1
int 0x80
; Exit program
mov eax, 1
xor ebx, ebx
int 0x80
c2VjdGlvbiAuZGF0YQogICAgcHJvbXB0MSBkYiAiS2V5IGluIHRoZSBmaXJzdCBudW1iZXIgOiAiLCAwCiAgICBwcm9tcHQyIGRiICJLZXkgaW4gdGhlIHNlY29uZCBudW1iZXIgOiAiLCAwCiAgICByZXN1bHQxIGRiICJUaGUgdG90YWwgaXMgIiwgMAogICAgcmVzd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51bTEKICAgIG1vdiBlZHgsIDEKICAgIGludCAweDgwCgogICAgCiAgICBtb3YgZWF4LCA0CiAgICBtb3YgZWJ4LCAxCiAgICBtb3YgZWN4LCBuZXdsaW5lCiAgICBtb3YgZWR4LCAxCiAgICBpbnQgMHg4MAoKICAgIG1vdiBhbCwgW251bTFdCiAgICBkaXYgYnl0ZSBbbnVtMl0KICAgIG1vdiBbbnVtMV0sIGFsCgogIAogICAgbW92IGVheCwgNAogICAgbW92IGVieCwgMQogICAgbW92IGVjeCwgcmVzdWx0MgogICAgbW92IGVkeCwgMTYKICAgIGludCAweDgwCgogICAgbW92IGFsLCBbbnVtMV0KICAgIGFkZCBhbCwgJzAnCiAgICBtb3YgW251bTFdLCBhbAogICAgbW92IGVjeCwgbnVtMQogICAgbW92IGVkeCwgMQogICAgaW50IDB4ODAKCiAgIAogICAgbW92IGVheCwgNAogICAgbW92IGVieCwgMQogICAgbW92IGVjeCwgbmV3bGluZQogICAgbW92IGVkeCwgMQogICAgaW50IDB4ODAKCgogICAgbW92IGFsLCBbbnVtMV0KICAgIG1vdiBhaCwgMAogICAgZGl2IGJ5dGUgW251bTJdCiAgICBtb3YgW251bTFdLCBhaAoKICAgCiAgICBtb3YgZWF4LCA0CiAgICBtb3YgZWJ4LCAxCiAgICBtb3YgZWN4LCByZXN1bHQzCiAgICBtb3YgZWR4LCAxNwogICAgaW50IDB4ODAKCiAgICBtb3YgYWwsIFtudW0xXQogICAgYWRkIGFsLCAnMCcKICAgIG1vdiBbbnVtMV0sIGFsCiAgICBtb3YgZWN4LCBudW0xCiAgICBtb3YgZWR4LCAxCiAgICBpbnQgMHg4MAoKICAKICAgIG1vdiBlYXgsIDQKICAgIG1vdiBlYngsIDEKICAgIG1vdiBlY3gsIG5ld2xpbmUKICAgIG1vdiBlZHgsIDEKICAgIGludCAweDgwCgogICAgOyBFeGl0IHByb2dyYW0KICAgIG1vdiBlYXgsIDEKICAgIHhvciBlYngsIGVieAogICAgaW50IDB4ODA=