Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .intel_syntax noprefix
- .section .rodata
- .align 8
- .LC1:
- .string "Please enter one of the possible execution keys: -r, -f, -c"
- .LC2:
- .string "-r"
- .LC3:
- .string "e^%lf = %lf\n"
- .LC5:
- .string "Program execution time: %lf\n"
- .LC6:
- .string "-c"
- .LC7:
- .string "%lf"
- .LC8:
- .string "%lf\n"
- .LC9:
- .string "-f"
- .LC10:
- .string "Incorrect input"
- .LC11:
- .string "r"
- .LC12:
- .string "w"
- .text
- .globl main
- .type main, @function
- main:
- push rbp
- mov rbp, rsp
- add rsp, -128
- mov DWORD PTR -116[rbp], edi # argc
- mov QWORD PTR -128[rbp], rsi # argv
- cmp DWORD PTR -116[rbp], 0
- jne .L6
- lea rdi, .LC1[rip] # "Please enter one of the possible execution keys: -r, -f, -c\n"
- call puts@PLT
- mov eax, 0
- jmp .L15
- .L6:
- mov rax, QWORD PTR -128[rbp]
- add rax, 8
- mov rax, QWORD PTR [rax]
- lea rsi, .LC2[rip] # "-r"
- mov rdi, rax # argv[1]
- call strcmp@PLT
- test eax, eax
- jne .L8
- mov edi, 0 # 0 - arg1
- call time@PLT
- mov edi, eax # time(0)
- call srand@PLT
- call rand@PLT
- movsx rdx, eax
- imul rdx, rdx, -2078209981
- shr rdx, 32
- add edx, eax
- mov ecx, edx
- sar ecx, 4
- cdq
- sub ecx, edx
- mov edx, ecx
- sal edx, 5
- sub edx, ecx
- sub eax, edx
- mov ecx, eax
- cvtsi2sd xmm0, ecx
- movsd QWORD PTR -112[rbp], xmm0
- call clock@PLT
- mov QWORD PTR -32[rbp], rax
- mov rax, QWORD PTR -112[rbp]
- movq xmm0, rax # x
- call solve
- movq rax, xmm0
- mov QWORD PTR -80[rbp], rax
- call clock@PLT
- mov QWORD PTR -24[rbp], rax
- mov rax, QWORD PTR -112[rbp]
- movsd xmm0, QWORD PTR -80[rbp]
- movapd xmm1, xmm0 # res
- movq xmm0, rax # x
- lea rdi, .LC3[rip] # "e^%lf = %lf\n"
- mov eax, 2
- call printf@PLT
- mov rax, QWORD PTR -24[rbp]
- sub rax, QWORD PTR -32[rbp]
- cvtsi2sd xmm0, rax
- movsd xmm1, QWORD PTR .LC4[rip]
- divsd xmm0, xmm1
- movsd QWORD PTR -16[rbp], xmm0
- mov rax, QWORD PTR -16[rbp]
- movq xmm0, rax # time_spent
- lea rdi, .LC5[rip] # "Program execution time: %lf\n"
- mov eax, 1
- call printf@PLT
- jmp .L9
- .L8:
- mov rax, QWORD PTR -128[rbp]
- add rax, 8
- mov rax, QWORD PTR [rax]
- lea rsi, .LC6[rip] # "-c"
- mov rdi, rax # argv[1]
- call strcmp@PLT
- test eax, eax
- jne .L10
- lea rax, -112[rbp]
- mov rsi, rax # &x
- lea rdi, .LC7[rip] # "%lf"
- mov eax, 0
- call __isoc99_scanf@PLT
- call clock@PLT
- mov QWORD PTR -56[rbp], rax
- mov rax, QWORD PTR -112[rbp]
- movq xmm0, rax # x
- call solve
- movq rax, xmm0
- mov QWORD PTR -80[rbp], rax
- call clock@PLT
- mov QWORD PTR -48[rbp], rax
- mov rax, QWORD PTR -80[rbp]
- movq xmm0, rax # res
- lea rdi, .LC8[rip] # "%lf\n"
- mov eax, 1
- call printf@PLT
- mov rax, QWORD PTR -48[rbp]
- sub rax, QWORD PTR -56[rbp]
- cvtsi2sd xmm0, rax
- movsd xmm1, QWORD PTR .LC4[rip]
- divsd xmm0, xmm1
- movsd QWORD PTR -40[rbp], xmm0
- mov rax, QWORD PTR -40[rbp]
- movq xmm0, rax # time_spent
- lea rdi, .LC5[rip] # "Program execution time: %lf\n"
- mov eax, 1
- call printf@PLT
- jmp .L9
- .L10:
- mov rax, QWORD PTR -128[rbp]
- add rax, 8
- mov rax, QWORD PTR [rax]
- lea rsi, .LC9[rip] # "-f"
- mov rdi, rax # argv[1]
- call strcmp@PLT
- test eax, eax
- jne .L11
- cmp DWORD PTR -116[rbp], 4
- je .L12
- lea rdi, .LC10[rip] # "Incorrect input\n"
- call puts@PLT
- mov eax, 0
- jmp .L15
- .L12:
- mov rax, QWORD PTR -128[rbp]
- add rax, 16
- mov rax, QWORD PTR [rax]
- lea rsi, .LC11[rip] # "r"
- mov rdi, rax # argv[2]
- call fopen@PLT
- mov QWORD PTR -104[rbp], rax
- mov rax, QWORD PTR -128[rbp]
- add rax, 24
- mov rax, QWORD PTR [rax]
- lea rsi, .LC12[rip] # "w"
- mov rdi, rax # argv[3]
- call fopen@PLT
- mov QWORD PTR -96[rbp], rax
- cmp QWORD PTR -104[rbp], 0
- je .L13
- cmp QWORD PTR -96[rbp], 0
- jne .L14
- .L13:
- lea rdi, .LC10[rip] # "Incorrect input\n"
- call puts@PLT
- mov eax, 0
- jmp .L15
- .L14:
- lea rdx, -112[rbp] # &x
- mov rax, QWORD PTR -104[rbp]
- lea rsi, .LC7[rip] # "%lf"
- mov rdi, rax # input
- mov eax, 0
- call __isoc99_fscanf@PLT
- call clock@PLT
- mov QWORD PTR -88[rbp], rax
- mov rax, QWORD PTR -112[rbp]
- movq xmm0, rax # x
- call solve
- movq rax, xmm0
- mov QWORD PTR -80[rbp], rax
- call clock@PLT
- mov QWORD PTR -72[rbp], rax
- mov rdx, QWORD PTR -80[rbp]
- mov rax, QWORD PTR -96[rbp]
- movq xmm0, rdx # res
- lea rsi, .LC8[rip] # "%lf\n"
- mov rdi, rax # output
- mov eax, 1
- call fprintf@PLT
- mov rax, QWORD PTR -72[rbp]
- sub rax, QWORD PTR -88[rbp]
- cvtsi2sd xmm0, rax
- movsd xmm1, QWORD PTR .LC4[rip]
- divsd xmm0, xmm1
- movsd QWORD PTR -64[rbp], xmm0
- mov rax, QWORD PTR -64[rbp]
- movq xmm0, rax # time_spent
- lea rdi, .LC5[rip] # "Program execution time: %lf\n"
- mov eax, 1
- call printf@PLT
- mov rax, QWORD PTR -104[rbp]
- mov rdi, rax # input
- call fclose@PLT
- mov rax, QWORD PTR -96[rbp]
- mov rdi, rax # output
- call fclose@PLT
- jmp .L9
- .L11:
- lea rdi, .LC1[rip] # "Please enter one of the possible execution keys: -r, -f, -c\n"
- call puts@PLT
- .L9:
- mov eax, 0
- .L15:
- leave
- ret
- .size main, .-main
- .section .rodata
- .align 8
- .LC0:
- .long 0
- .long 1072693248
- .align 8
- .LC4:
- .long 0
- .long 1093567616
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement