Answer:
1)
.LC0:
.string \"Enter the value of N \"
.LC1:
.string \"%d\"
.LC2:
.string \"Enter the numbers \"
.LC3:
.string \"The numbers arranged in ascending order are given below \"
.LC4:
.string \"%d\ \"
main:
pushq %rbp
movq %rsp, %rbp
subq $144, %rsp
movl $.LC0, %edi
call puts
leaq -16(%rbp), %rax
movq %rax, %rsi
movl $.LC1, %edi
movl $0, %eax
call scanf
movl $.LC2, %edi
call puts
movl $0, -4(%rbp)
.L3:
movl -16(%rbp), %eax
cmpl %eax, -4(%rbp)
jge .L2
leaq -144(%rbp), %rax
movl -4(%rbp), %edx
movslq %edx, %rdx
salq $2, %rdx
addq %rdx, %rax
movq %rax, %rsi
movl $.LC1, %edi
movl $0, %eax
call scanf
addl $1, -4(%rbp)
jmp .L3
.L2:
movl $0, -4(%rbp)
.L8:
movl -16(%rbp), %eax
cmpl %eax, -4(%rbp)
jge .L4
movl -4(%rbp), %eax
addl $1, %eax
movl %eax, -8(%rbp)
.L7:
movl -16(%rbp), %eax
cmpl %eax, -8(%rbp)
jge .L5
movl -4(%rbp), %eax
cltq
movl -144(%rbp,%rax,4), %edx
movl -8(%rbp), %eax
cltq
movl -144(%rbp,%rax,4), %eax
cmpl %eax, %edx
jle .L6
movl -4(%rbp), %eax
cltq
movl -144(%rbp,%rax,4), %eax
movl %eax, -12(%rbp)
movl -8(%rbp), %eax
cltq
movl -144(%rbp,%rax,4), %edx
movl -4(%rbp), %eax
cltq
movl %edx, -144(%rbp,%rax,4)
movl -8(%rbp), %eax
cltq
movl -12(%rbp), %edx
movl %edx, -144(%rbp,%rax,4)
.L6:
addl $1, -8(%rbp)
jmp .L7
.L5:
addl $1, -4(%rbp)
jmp .L8
.L4:
movl $.LC3, %edi
call puts
movl $0, -4(%rbp)
.L10:
movl -16(%rbp), %eax
cmpl %eax, -4(%rbp)
jge .L9
movl -4(%rbp), %eax
cltq
movl -144(%rbp,%rax,4), %eax
movl %eax, %esi
movl $.LC4, %edi
movl $0, %eax
call printf
addl $1, -4(%rbp)
jmp .L10
.L9:
movl $0, %eax
leave
ret
2)
.zero 1
.LC0:
.string \"Enter two numbers: \"
.LC1:
.string \"Product = \"
main:
pushq %rbp
movq %rsp, %rbp
subq $32, %rsp
movl $.LC0, %esi
movl std::cout, %edi
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
leaq -8(%rbp), %rax
movq %rax, %rsi
movl std::cin, %edi
call std::basic_istream >::operator>>(float&)
movq %rax, %rdx
leaq -12(%rbp), %rax
movq %rax, %rsi
movq %rdx, %rdi
call std::basic_istream >::operator>>(float&)
movss -8(%rbp), %xmm1
movss -12(%rbp), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, -4(%rbp)
movl $.LC1, %esi
movl std::cout, %edi
call std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)
movq %rax, %rdx
movl -4(%rbp), %eax
movl %eax, -20(%rbp)
movss -20(%rbp), %xmm0
movq %rdx, %rdi
call std::basic_ostream >::operator<<(float)
movl $0, %eax
leave
ret
__static_initialization_and_destruction_0(int, int):
pushq %rbp
movq %rsp, %rbp
subq $16, %rsp
movl %edi, -4(%rbp)
movl %esi, -8(%rbp)
cmpl $1, -4(%rbp)
jne .L5
cmpl $65535, -8(%rbp)
jne .L5
movl std::__ioinit, %edi
call std::ios_base::Init::Init()
movl $__dso_handle, %edx
movl std::__ioinit, %esi
movl std::ios_base::Init::~Init(), %edi
call __cxa_atexit
.L5:
nop
leave
ret
pushq %rbp
movq %rsp, %rbp
movl $65535, %esi
movl $1, %edi
call __static_initialization_and_destruction_0(int, int)
popq %rbp
ret
Solution
Answer:
1)
.LC0:
.string \"Enter the value of N \"
.LC1:
.string \"%d\"
.LC2:
.string \"Enter the numbe.