Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .code64
- .text
- .globl main
- .type main, @function
- write:
- pushq %rcx
- movl %eax,%esi
- movq $format_out, %rdi
- xorq %rax,%rax
- call printf
- popq %rcx
- ret
- read: movq $8,%rcx
- read1:
- movq $format_in,%rdi
- movq $Y2,%rsi
- movq %rcx,%rax
- subq $1,%rax
- movq $4,%rdx
- mulq %rdx
- addq %rax,%rsi
- xorq %rax,%rax
- pushq %rcx
- call scanf
- popq %rcx
- loopl read1
- ret
- abs:
- cmpl $0,%eax
- jge abs_end
- negl %eax
- abs_end:
- ret
- max:
- pushq %rbp
- movq %rsp,%rbp
- movl 16(%rsp),%eax
- movl 24(%rsp),%ebx
- cmpl %eax,%ebx
- jle max_a
- movl %ebx,%eax
- max_a:
- popq %rbp
- ret
- min:
- pushq %rbp
- movq %rsp,%rbp
- movl 16(%rsp),%eax
- movl 24(%rsp),%ebx
- cmpl %eax,%ebx
- jge min_a
- movl %ebx,%eax
- min_a:
- popq %rbp
- ret
- square:
- movl x2,%eax
- movl x1,%ebx
- subl %ebx,%eax
- call abs
- pushq %rax
- movl y2,%eax
- movl y1,%ebx
- subl %ebx,%eax
- call abs
- movl %eax,%ebx
- popq %rax
- mull %ebx
- ret
- Ix:
- movl x2,%eax
- pushq %rax
- movl X2,%eax
- pushq %rax
- call min
- popq %rdx
- popq %rdx
- pushq %rax
- movl X1,%eax
- pushq %rax
- call min
- popq %rdx
- popq %rdx
- pushq %rax
- movl x1,%eax
- pushq %rax
- call min
- popq %rdx
- popq %rdx
- pushq %rax
- movl x2,%eax
- pushq %rax
- movl X2,%eax
- pushq %rax
- call max
- popq %rdx
- popq %rdx
- pushq %rax
- movl X1,%eax
- pushq %rax
- call max
- popq %rdx
- popq %rdx
- pushq %rax
- movl x1,%eax
- pushq %rax
- call max
- popq %rdx
- popq %rdx
- movl %eax,%ebx
- popq %rax
- subl %ebx,%eax
- call abs
- pushq %rax
- movl x2,%ebx
- movl x1,%eax
- subl %ebx,%eax
- call abs
- movl %eax,%ebx
- popq %rax
- subl %eax,%ebx
- pushq %rbx
- movl X2,%ebx
- movl X1,%eax
- subl %ebx,%eax
- call abs
- popq %rbx
- addl %ebx,%eax
- ret
- Iy:
- movl y2,%eax
- pushq %rax
- movl Y2,%eax
- pushq %rax
- call min
- popq %rdx
- popq %rdx
- pushq %rax
- movl Y1,%eax
- pushq %rax
- call min
- popq %rdx
- popq %rdx
- pushq %rax
- movl y1,%eax
- pushq %rax
- call min
- popq %rdx
- popq %rdx
- pushq %rax
- movl y2,%eax
- pushq %rax
- movl Y2,%eax
- pushq %rax
- call max
- popq %rdx
- popq %rdx
- pushq %rax
- movl Y1,%eax
- pushq %rax
- call max
- popq %rdx
- popq %rdx
- pushq %rax
- movl y1,%eax
- pushq %rax
- call max
- popq %rdx
- popq %rdx
- movl %eax,%ebx
- popq %rax
- subl %ebx,%eax
- call abs
- pushq %rax
- movl y2,%ebx
- movl y1,%eax
- subl %ebx,%eax
- call abs
- movl %eax,%ebx
- popq %rax
- subl %eax,%ebx
- pushq %rbx
- movl Y2,%ebx
- movl Y1,%eax
- subl %ebx,%eax
- call abs
- popq %rbx
- addl %ebx,%eax
- ret
- main:
- call read
- call Ix
- pushq %rax
- cmpl $0,%eax
- jle non_sub
- call Iy
- cmpl $0,%eax
- jle non_sub
- popq %rbx
- mull %ebx
- pushq %rax
- call square
- popq %rbx
- subl %ebx,%eax
- jmp end_main
- non_sub:
- call square
- end_main:
- call write
- movl $0, %eax
- mov $1,%eax
- int $0x80
- .data
- format_out:
- .string "%d\n"
- format_in:
- .string "%d"
- Y2: .long 0
- X2: .long 0
- Y1: .long 0
- X1: .long 0
- y2: .long 0
- x2: .long 0
- y1: .long 0
- x1: .long 0
- ans: .long 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement