section .data
a db 0x01, 0x02, 0x03 ; a = 0x030201
b db 0x05, 0x06, 0x07 ; b = 0x070605
c db 0x09, 0x0A, 0x0B ; c = 0x0B0A09
d db 0x00, 0x00, 0x00 ; результат (3 байта)
section .text
global _start
_start:
; Загружаем b в eax
movzx eax, byte [b]
movzx ebx, byte [b+1]
movzx ecx, byte [b+2]
shl ecx, 16
shl ebx, 8
or eax, ebx
or eax, ecx ; eax = b
sub eax, 1 ; b - 1
; Загружаем a в ebx
movzx ebx, byte [a]
movzx ecx, byte [a+1]
movzx edx, byte [a+2]
shl edx, 16
shl ecx, 8
or ebx, ecx
or ebx, edx ; ebx = a
add eax, ebx ; b - 1 + a
; Загружаем c в ebx
movzx ebx, byte [c]
movzx ecx, byte [c+1]
movzx edx, byte [c+2]
shl edx, 16
shl ecx, 8
or ebx, ecx
or ebx, edx ; ebx = c
sub eax, ebx ; (b - 1 + a) - c
; Сохраняем результат в d (3 байта)
mov [d], al
shr eax, 8
mov [d+1], al
shr eax, 8
mov [d+2], al
; Завершаем программу
mov eax, 1 ; syscall: exit
xor ebx, ebx ; status 0
int 0x80
c2VjdGlvbiAuZGF0YQogICAgYSAgZGIgMHgwMSwgMHgwMiwgMHgwMyAgOyBhID0gMHgwMzAyMDEKICAgIGIgIGRiIDB4MDUsIDB4MDYsIDB4MDcgIDsgYiA9IDB4MDcwNjA1CiAgICBjICBkYiAweDA5LCAweDBBLCAweDBCICA7IGMgPSAweDBCMEEwOQogICAgZCAgZGIgMHgwMCwgMHgwMCwgMHgwMCAgOyDRgNC10LfRg9C70YzRgtCw0YIgKDMg0LHQsNC50YLQsCkKCnNlY3Rpb24gLnRleHQKICAgIGdsb2JhbCBfc3RhcnQKCl9zdGFydDoKICAgIDsg0JfQsNCz0YDRg9C20LDQtdC8IGIg0LIgZWF4CiAgICBtb3Z6eCBlYXgsIGJ5dGUgW2JdICAgICAKICAgIG1vdnp4IGVieCwgYnl0ZSBbYisxXSAgIAogICAgbW92enggZWN4LCBieXRlIF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