Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -4[rbp] => r12d
- # -8[rbp] => r13d
- # -12[rbp] => r14d
- .intel_syntax noprefix # пишем в синаксисе intel
- .text # начинаем секцию
- addToPairs: # функция добаления пары в наш словарь
- push rbp # сохранение rbp на стек
- mov rbp, rsp # rbp := rsp
- mov QWORD PTR -24[rbp], rdi #
- mov QWORD PTR -32[rbp], rsi #
- mov QWORD PTR -40[rbp], rdx #
- mov QWORD PTR -48[rbp], rcx #
- mov r12d, 0
- jmp .L2
- .L9:
- mov eax, r12d
- movsx rdx, eax
- mov rax, rdx
- sal rax, 4
- sub rax, rdx
- sal rax, 3
- mov rdx, rax
- mov rax, QWORD PTR -24[rbp]
- add rax, rdx
- mov rax, QWORD PTR [rax]
- cmp QWORD PTR -48[rbp], rax
- jne .L3
- mov r13d, 0
- jmp .L4
- .L8:
- mov eax, r12d
- movsx rdx, eax
- mov rax, rdx
- sal rax, 4
- sub rax, rdx
- sal rax, 3
- mov rdx, rax
- mov rax, QWORD PTR -24[rbp]
- add rdx, rax
- mov eax, r13d
- cdqe
- movzx edx, BYTE PTR 8[rdx+rax]
- mov eax, r13d
- movsx rcx, eax
- mov rax, QWORD PTR -40[rbp]
- add rax, rcx
- movzx eax, BYTE PTR [rax]
- cmp dl, al
- jne .L12
- mov eax, r13d
- cdqe
- mov rdx, QWORD PTR -48[rbp]
- sub rdx, 1
- cmp rax, rdx
- jne .L6
- mov eax, r12d
- movsx rdx, eax
- mov rax, rdx
- sal rax, 4
- sub rax, rdx
- sal rax, 3
- mov rdx, rax
- mov rax, QWORD PTR -24[rbp]
- add rax, rdx
- mov rdx, QWORD PTR 112[rax]
- add rdx, 1
- mov QWORD PTR 112[rax], rdx
- jmp .L1
- .L6:
- add r13d, 1
- .L4:
- mov eax, r13d
- cdqe
- cmp QWORD PTR -48[rbp], rax
- ja .L8
- jmp .L3
- .L12:
- nop
- .L3:
- add r12d, 1
- .L2:
- mov eax, r12d
- movsx rdx, eax
- mov rax, QWORD PTR -32[rbp]
- mov rax, QWORD PTR [rax]
- cmp rdx, rax
- jb .L9
- mov DWORD PTR -12[rbp], 0
- jmp .L10
- .L11:
- mov eax, DWORD PTR -12[rbp]
- movsx rdx, eax
- mov rax, QWORD PTR -40[rbp]
- lea rsi, [rdx+rax]
- mov rax, QWORD PTR -32[rbp]
- mov rdx, QWORD PTR [rax]
- mov rax, rdx
- sal rax, 4
- sub rax, rdx
- sal rax, 3
- mov rdx, rax
- mov rax, QWORD PTR -24[rbp]
- lea rcx, [rdx+rax]
- movzx edx, BYTE PTR [rsi]
- mov eax, DWORD PTR -12[rbp]
- cdqe
- mov BYTE PTR 8[rcx+rax], dl
- add DWORD PTR -12[rbp], 1
- .L10:
- mov eax, DWORD PTR -12[rbp]
- cdqe
- cmp QWORD PTR -48[rbp], rax
- ja .L11
- mov rax, QWORD PTR -32[rbp]
- mov rdx, QWORD PTR [rax]
- mov rax, rdx
- sal rax, 4
- sub rax, rdx
- sal rax, 3
- mov rdx, rax
- mov rax, QWORD PTR -24[rbp]
- add rdx, rax
- mov rax, QWORD PTR -48[rbp]
- mov QWORD PTR [rdx], rax
- mov rax, QWORD PTR -32[rbp]
- mov rdx, QWORD PTR [rax]
- mov rax, rdx
- sal rax, 4
- sub rax, rdx
- sal rax, 3
- mov rdx, rax
- mov rax, QWORD PTR -24[rbp]
- add rax, rdx
- mov QWORD PTR 112[rax], 1
- mov rax, QWORD PTR -32[rbp]
- mov rax, QWORD PTR [rax]
- lea rdx, 1[rax]
- mov rax, QWORD PTR -32[rbp]
- mov QWORD PTR [rax], rdx
- .L1:
- pop rbp
- ret
- .LC0:
- .string "%ld \n"
- .text
- .globl printPairs
- .type printPairs, @function
- printPairs:
- push rbp
- mov rbp, rsp
- sub rsp, 32
- mov QWORD PTR -24[rbp], rdi
- mov QWORD PTR -32[rbp], rsi
- mov r12d, 0
- jmp .L14
- .L17:
- mov r13d, 0
- jmp .L15
- .L16:
- mov eax, r12d
- movsx rdx, eax
- mov rax, rdx
- sal rax, 4
- sub rax, rdx
- sal rax, 3
- mov rdx, rax
- mov rax, QWORD PTR -24[rbp]
- add rdx, rax
- mov eax, r13d
- cdqe
- movzx eax, BYTE PTR 8[rdx+rax]
- movsx eax, al
- mov edi, eax
- call putchar@PLT
- add r13d, 1
- .L15:
- mov eax, r13d
- movsx rcx, eax
- mov eax, r12d
- movsx rdx, eax
- mov rax, rdx
- sal rax, 4
- sub rax, rdx
- sal rax, 3
- mov rdx, rax
- mov rax, QWORD PTR -24[rbp]
- add rax, rdx
- mov rax, QWORD PTR [rax]
- cmp rcx, rax
- jb .L16
- mov edi, 32
- call putchar@PLT
- mov eax, r12d
- movsx rdx, eax
- mov rax, rdx
- sal rax, 4
- sub rax, rdx
- sal rax, 3
- mov rdx, rax
- mov rax, QWORD PTR -24[rbp]
- add rax, rdx
- mov rax, QWORD PTR 112[rax]
- mov rsi, rax
- lea rdi, .LC0[rip]
- mov eax, 0
- call printf@PLT
- add r12d, 1
- .L14:
- mov eax, r12d
- cdqe
- cmp QWORD PTR -32[rbp], rax
- ja .L17
- nop
- nop
- leave
- ret
- createDictionary:
- push rbp
- mov rbp, rsp
- sub rsp, 4096
- or QWORD PTR [rsp], 0
- sub rsp, 2064
- mov QWORD PTR -6152[rbp], rdi
- mov QWORD PTR -6040[rbp], 0
- mov rax, QWORD PTR -6152[rbp]
- mov rdi, rax
- call strlen@PLT
- mov QWORD PTR -32[rbp], rax
- mov BYTE PTR -1[rbp], 1
- mov QWORD PTR -16[rbp], 0
- mov r14d, 0
- jmp .L19
- .L27:
- mov eax, r14d
- movsx rdx, eax
- mov rax, QWORD PTR -6152[rbp]
- add rax, rdx
- movzx eax, BYTE PTR [rax]
- cmp al, 47
- jle .L20
- mov eax, r14d
- movsx rdx, eax
- mov rax, QWORD PTR -6152[rbp]
- add rax, rdx
- movzx eax, BYTE PTR [rax]
- cmp al, 57
- jle .L21
- .L20:
- mov eax, r14d
- movsx rdx, eax
- mov rax, QWORD PTR -6152[rbp]
- add rax, rdx
- movzx eax, BYTE PTR [rax]
- cmp al, 64
- jle .L22
- mov eax, r14d
- movsx rdx, eax
- mov rax, QWORD PTR -6152[rbp]
- add rax, rdx
- movzx eax, BYTE PTR [rax]
- cmp al, 90
- jle .L21
- .L22:
- mov eax, r14d
- movsx rdx, eax
- mov rax, QWORD PTR -6152[rbp]
- add rax, rdx
- movzx eax, BYTE PTR [rax]
- cmp al, 96
- jle .L23
- mov eax, r14d
- movsx rdx, eax
- mov rax, QWORD PTR -6152[rbp]
- add rax, rdx
- movzx eax, BYTE PTR [rax]
- cmp al, 122
- jle .L21
- .L23:
- cmp QWORD PTR -16[rbp], 0
- je .L24
- mov rcx, QWORD PTR -16[rbp]
- lea rdx, -6144[rbp]
- lea rsi, -6040[rbp]
- lea rdi, -6032[rbp]
- call addToPairs
- .L24:
- mov BYTE PTR -1[rbp], 1
- mov QWORD PTR -16[rbp], 0
- jmp .L25
- .L21:
- cmp QWORD PTR -16[rbp], 0
- jne .L26
- mov eax, r14d
- movsx rdx, eax
- mov rax, QWORD PTR -6152[rbp]
- add rax, rdx
- movzx eax, BYTE PTR [rax]
- cmp al, 47
- jle .L26
- mov eax, r14d
- movsx rdx, eax
- mov rax, QWORD PTR -6152[rbp]
- add rax, rdx
- movzx eax, BYTE PTR [rax]
- cmp al, 57
- jg .L26
- mov BYTE PTR -1[rbp], 0
- jmp .L25
- .L26:
- cmp BYTE PTR -1[rbp], 0
- je .L25
- mov eax, r14d
- movsx rdx, eax
- mov rax, QWORD PTR -6152[rbp]
- lea rcx, [rdx+rax]
- mov rax, QWORD PTR -16[rbp]
- lea rdx, 1[rax]
- mov QWORD PTR -16[rbp], rdx
- movzx edx, BYTE PTR [rcx]
- mov BYTE PTR -6144[rbp+rax], dl
- .L25:
- add r14d, 1
- .L19:
- mov eax, r14d
- cdqe
- cmp QWORD PTR -32[rbp], rax
- ja .L27
- mov rdx, QWORD PTR -6040[rbp]
- lea rax, -6032[rbp]
- mov rsi, rdx
- mov rdi, rax
- call printPairs
- nop
- leave
- ret
- .size createDictionary, .-createDictionary
- .globl main
- .type main, @function
- main:
- push rbp # сохраняем rbp на стек
- mov rbp, rsp # rbp := rsp
- sub rsp, 1008 # rsp -= 1008 (выделяем память для фрейма)
- mov rdx, QWORD PTR stdin[rip]
- lea rax, -1008[rbp] # rax := rbp -1008
- mov esi, 1000 # esi := 1000
- mov rdi, rax # rdi := rax
- call fgets@PLT # вызов функции fgets
- lea rdi, -1008[rbp] # rdi := rbp - 1008
- call createDictionary # вызов функции createDictionary
- mov eax, 0 # возвращение в eax 0
- leave # / выход из функции
- ret # \
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement