Question: .file assignment2.c .text .globl num .section .rodata .align 4 .type num, @object .size num, 4 num: .long 20 .LC0: .string The value of n is:

 .file "assignment2.c" .text .globl num .section .rodata .align 4 .type num,

.file "assignment2.c" .text .globl num .section .rodata .align 4 .type num, @object .size num, 4 num: .long 20 .LC0: .string "The value of n is: %d " .text .globl mathLoop .type mathLoop, @function mathLoop: .LFB6: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 subq $32, %rsp movl %edi, -20(%rbp) movl $4, -8(%rbp) movl $0, -4(%rbp) jmp .L2 .L3: movl $20, %eax imull -8(%rbp), %eax addl %eax, -20(%rbp) movl -20(%rbp), %eax movl %eax, %esi leaq .LC0(%rip), %rdi movl $0, %eax call printf@PLT addl $1, -4(%rbp) .L2: cmpl $3, -4(%rbp) jle .L3 movl -20(%rbp), %eax leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE6: .size mathLoop, .-mathLoop .globl main .type main, @function main: .LFB7: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl $4, %edi call mathLoop movl $0, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE7: .size main, .-main .ident "GCC: (Debian 10.2.0-16) 10.2.0" .section .note.GNU-stack,"",@progbits

PROGRAMMING ASSIGNMENT 2 - ANALYZING ASSEMBLY Please download the assignment2.s file, inspect the assembly code, and tell me what you believe the program does. You are free to view the code using VIM, run it in gdb, inspect symbols with objdump -t [filename], but you CANNOT make it into an executable and simply run the program from your terminal. You will also need to describe each line (or block ) of code and tell me what you think it does. You have 2 weeks to work on this assignment. When you are done, upload a Word or PDF document containing your analysis and any screenshots you took along the way. For instance, you might say: Line 2: .globl myValue appears to be a global variable. Line 8: myValue: .long 40 tells me the variable myValue is a long int with a value of 40. This suggests it could be a constant, but I am not sure. Line 22: ........... I can now see that myValue is in fact a constant int that was initialized to 40. Etc...... Also, Write a Hello World program in assembly using the NASM compiler (which you will have to download in Kali)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!