section .data
fmt_in: db "%u %u", 0
fmt_out: db "%u", 10, 0
N: dd 0
K: dd 0
section .text
global main
extern printf
extern scanf
main:
push ebp
mov ebp, esp
;-----------------------------
push K
push N
push fmt_in
call scanf
add esp, 12
;-----------------------------
mov ebx, [K]
mov cl, bl
mov eax, 1
shl eax, cl
dec eax
mov edi, eax
;-----------------------------
xor ecx, ecx
xor esi, esi
first:
mov eax, 32
sub eax, ebx
cmp ecx, eax
ja end
;-----------------------------
mov eax, [N]
shr eax, cl
and eax, edi
;-----------------------------
cmp eax, esi
jbe max
mov esi, eax
max:
inc ecx
jmp first
end:
push esi
push fmt_out
call printf
add esp, 8
;----------------------------
mov esp, ebp
pop ebp
xor eax, eax
ret