.section .rodata .align 8 .LC0: .string "Hello. This's my final work program " .LC1: .string "You can chose next function: " .LC2: .string "1. Type text " .LC3: .string "2. View content file " .LC4: .string "3. About use " .LC5: .string "4. Exit " .LC6: .string "\nPlease write number: " .LC7: .string "%d" .LC8: .string "You can write you chars: " .LC9: .string "a" .LC10: .string "text.txt" .align 8 .LC11: .string "You press %c. ASCII code : %d \n" .LC12: .string "===End you text===\n" .LC13: .string "Data in file: \n" .LC14: .string "r" .LC15: .string "\n\n!!! FILE NOT FOUND !!!\n" .LC16: .string "%s" .LC17: .string "\n\n===EOF===\n" .align 8 .LC18: .string "Hello. This's my final cource program \nYou can:\n1.Type and save text\n2.View text\nThis program very simple, because writing in Assembler AT&T for training =)" .LC19: .string "Good luck! " .text .globl main .type main, @function main: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 pushq %rbx subq $312, %rsp .cfi_offset 3, -24 movq %fs:40, %rax movq %rax, -24(%rbp) xorl %eax, %eax .L2: movl $.LC0, %edi call puts movl $.LC1, %edi call puts movl $.LC2, %edi call puts movl $.LC3, %edi call puts movl $.LC4, %edi call puts movl $.LC5, %edi call puts movl $.LC6, %edi movl $0, %eax call printf leaq -312(%rbp), %rax movq %rax, %rsi movl $.LC7, %edi movl $0, %eax call __isoc99_scanf movl -312(%rbp), %eax movl %eax, -312(%rbp) movl -312(%rbp), %eax cmpl $2, %eax je .L4 cmpl $2, %eax jg .L5 cmpl $1, %eax je .L6 jmp .L3 .L5: cmpl $3, %eax je .L7 cmpl $4, %eax je .L8 jmp .L3 .L6: movl $.LC8, %edi movl $0, %eax call printf movl $.LC9, %esi movl $.LC10, %edi call fopen movq %rax, -304(%rbp) .L9: call getchar movl %eax, -308(%rbp) movl -308(%rbp), %ecx movl -308(%rbp), %edx movq -304(%rbp), %rax movl $.LC11, %esi movq %rax, %rdi movl $0, %eax call fprintf cmpl $27, -308(%rbp) jne .L9 movl $.LC12, %edi call puts movq -304(%rbp), %rax movq %rax, %rdi call fclose jmp .L2 .L4: movl $.LC13, %edi call puts movl $.LC14, %esi movl $.LC10, %edi call fopen movq %rax, -296(%rbp) cmpq $0, -296(%rbp) jne .L10 movl $.LC15, %edi call puts jmp .L2 .L10: jmp .L12 .L13: leaq -288(%rbp), %rax movq %rax, %rsi movl $.LC16, %edi movl $0, %eax call printf .L12: leaq -288(%rbp), %rdx movq -296(%rbp), %rax movl $.LC16, %esi movq %rax, %rdi movl $0, %eax call __isoc99_fscanf cmpl $-1, %eax jne .L13 movl $.LC17, %edi call puts movq -296(%rbp), %rax movq %rax, %rdi call fclose nop jmp .L2 .L7: movl $.LC18, %edi call puts nop movl $0, %eax jmp .L16 .L8: movl $.LC19, %edi call puts movl $0, %eax jmp .L16 .L3: movl $0, %eax .L16: movq -24(%rbp), %rbx xorq %fs:40, %rbx je .L17 call __stack_chk_fail .L17: addq $312, %rsp popq %rbx popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1" .section .note.GNU-stack,"",@progbits