CS 410 Binary to Assembly Activity

docx

School

Southern New Hampshire University *

*We aren’t endorsed by this school

Course

410

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

2

Uploaded by BailiffSpider1312

Report
CS 410 Binary to Assembly Activity Template Step 1: List the binary file name. Step 2: Identify the functions in the binary file. Step 3 : Convert the binary file to assembly code. Step 4: Align the blocks of assembly code with their corresponding function in the binary file. Step 5: Explain the functionality of the blocks of assembly code. File One: [assignment3_1.o] Functions Blocks of Assembly Code Explanation of Functionality push %rbp Pushes the value of rbp to the stack. Prints string mov $0x400634,%edi callq 0x400450 <puts@plt> This moves 0x400634 value to edi and then prints it Prints string mov $0x400648,%edi callq 0x400450 <puts@plt> This moves 0x400648 value to edi and then prints it Prints string mov $0x40065c,%edi callq 0x400450 <puts@plt> This moves 0x40065c value to edi and then prints it File Two: [assignment3_2.o] Functions Blocks of Assembly Code Explanation of Functionality mov %rsp,%rbp This moves rsp to rbp Subtraction sub $0x20,%rsp This subtracts 0x20 from rsp mov %fs:0x28,%rax This moves fs:0x28 to rax   mov %rax,-0x8(%rbp) This moves rax to rdp cin xor %eax,%eax mov $0x400714,%edi callq 0x4004e0 <puts@plt> This asks for the users input Scans value lea -0x20(%rbp),%rax mov %rax,%rsi mov $0x40072b,%edi mov $0x0,%eax callq 0x400520 <__isoc99_scanf@plt> This checks for a value cout lea -0x20(%rbp),%rax mov %rax,%rsi mov $0x40072e,%edi mov $0x0,%eax callq 0x4004f0 <printf@plt> This prints the result File Three: [List file name here.]
Functions Blocks of Assembly Code Explanation of Functionality  cin callq 0x4004e0 <puts@plt> This Asks user for their input  Variables x, j ea -0x8(%rbp),%rdx lea -0xc(%rbp),%rax Creates variables x and j  addition mov -0x8(%rbp),%edx mov -0xc(%rbp),%eax mov %edx,%esi mov %eax,%edi callq 0x40062d <AddNumbers> This Uses addition to add the variables together  cout callq 0x4004f0 <printf@plt> This prints the result File Four: [assingment3_4.o] Functions Blocks of Assembly Code Explanation of Functionality  Initiate variable mov %eax,-0x4(%rbp) mov -0x8(%rbp),%eax This create the variable  Cout cin Subtraction Comparison mov %eax,%esi mov $0x400844,%edi mov $0x0,%eax callq 0x4004f0 <printf@plt> subl $0x1,-0x8(%rbp) cmpl $0x0,-0x8(%rbp) The variable is printed then 1 is subtracted to see if the value is 1  For loop jg 0x400647 <PrintFact+26> mov -0x4(%rbp),%eax mov %eax,%esi mov $0x400848,%edi mov $0x0,%eax callq 0x4004f0 <printf@plt> mov -0x4(%rbp),%eax leaveq retq Prints then Continually loops until the value is 1  
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help