extern scanf, printf, strcmp, strcpy
section .data
fmt_n db "%u", 0
fmt_s db "%10s", 0
fmt_out db "%u", 10, 0
section .bss
n resd 1
unique_cnt resd 1
temp resb 11
strings resb 500 * 11
section .text
global main
main:
push ebp
mov ebp, esp
push n
push fmt_n
call scanf
add esp, 8
mov dword [unique_cnt], 0
xor ecx, ecx
read_loop:
cmp ecx, [n]
jge finish
push temp
push fmt_s
call scanf
add esp, 8
xor edx, edx
check_loop:
cmp edx, [unique_cnt]
jge add_string
mov eax, edx
imul eax, 11
lea ebx, [strings + eax]
push temp
push ebx
call strcmp
add esp, 8
test eax, eax
jz already_exists
inc edx
jmp check_loop
add_string:
mov eax, [unique_cnt]
imul eax, 11
lea ebx, [strings + eax]
push temp
push ebx
call strcpy
add esp, 8
inc dword [unique_cnt]
already_exists:
inc ecx
jmp read_loop
finish:
push dword [unique_cnt]
push fmt_out
call printf
add esp, 8
xor eax, eax
mov esp, ebp
pop ebp
ret