CS 410 Project One Proficiency Test

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

9

Uploaded by BailiffSpider1312

Report
CS 410 Project One Proficiency Test Template Explain the functionality of the blocks of assembly code. “main” function” 1
Assembly Code Block Explanation of Functionality push %rbp mov %rsp,%rbp lea 0x0(%rip),%rsi # 0xb <main+11> lea 0x0(%rip),%rdi # 0x12 <main+18> callq 0x17 <main+23> This starts the program and prints “Hello! Welcome to our investment company” callq 0x1c <main+28> mov %eax,0x0(%rip) # 0x22 <main+34> mov 0x0(%rip),%eax # 0x28 <main+40> cmp $0x1,%eax je 0x40 <main+64> lea 0x0(%rip),%rsi # 0x34 <main+52> lea 0x0(%rip),%rdi # 0x3b <main+59> callq 0x40 <main+64> This uses a while loop for CheckUserPermissions, it is checked and if true, jumps to 0x40, if false, prints "Invalid Password. Please try again". Compare %eax by 1 Jump if equal to <main+64> mov 0x0(%rip),%eax # 0x46 <main+70> cmp $0x1,%eax je 0x4d <main+77> jmp 0x17 <main+23> The conditional jump for while loop allows the user to exit the loop if the password is valid. If it isn’t valid, it jumps back to the beginning of the loop. Jump if equal <main+77> Jump <main+23> lea 0x0(%rip),%rsi # 0x54 <main+84> lea 0x0(%rip),%rdi # 0x5b <main+91> callq 0x60 <main+96> lea 0x0(%rip),%rsi # 0x67 <main+103> lea 0x0(%rip),%rdi # 0x6e <main+110> callq 0x73 <main+115> lea 0x0(%rip),%rsi # 0x7a <main+122> lea 0x0(%rip),%rdi # 0x81 <main+129> callq 0x86 <main+134> lea 0x0(%rip),%rsi # 0x8d <main+141> lea 0x0(%rip),%rdi # 0x94 <main+148> callq 0x99 <main+153> This is a while loop that prompts the user to choose from a menu of options, the first choice(1) is “display the client list”, the second choice(2) is “change a client's choice”, and the last choice(3) is “exit the program” lea 0x0(%rip),%rsi # 0xa0 <main+160> lea 0x0(%rip),%rdi # 0xa7 <main+167> callq 0xac <main+172> This reads the users choice between choice 1,2, and 3, then stores it in a variable lea 0x0(%rip),%rsi # 0xb3 <main+179> lea 0x0(%rip),%rdi # 0xba <main+186> callq 0xbf <main+191> mov %rax,%rdx mov 0x0(%rip),%eax # 0xc8 <main+200> mov %eax,%esi mov %rdx,%rdi callq 0xd2 <main+210> mov %rax,%rdx mov 0x0(%rip),%rax # 0xdc <main+220> mov %rax,%rsi mov %rdx,%rdi callq 0xe7 <main+231> This Validates user input with a print statement "You Chose" input variable(1, 2, or 3). mov 0x0(%rip),%eax # 0xed <main+237> This outputs the results of the user’s choice. If the 2
ChangeCustomerChoice function 3
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
Assembly Code Block Explanation of Functionality push %rbp mov %rsp,%rbp lea 0x0(%rip),%rsi # 0x438 lea 0x0(%rip),%rdi # 0x43f callq 0x444 This prints a statement that says “Enter the number of the client that you wish to change” lea 0x0(%rip),%rsi # 0x44b lea 0x0(%rip),%rdi # 0x452 callq 0x457 This uses the cin function to get the users input and stores it in a variable in int ChangeChoice lea 0x0(%rip),%rsi # 0x45e lea 0x0(%rip),%rdi # 0x465 callq 0x46a This prints out “Please enter the client's new service choice” option 1 being “brokerage” and option 2 being “retirement” lea 0x0(%rip),%rsi # 0x471 lea 0x0(%rip),%rdi # 0x478 callq 0x47d This uses the cin function to get the users input and stores it in a variable in int newService mov 0x0(%rip),%eax # 0x483 cmp $0x1,%eax jne 0x496 mov 0x0(%rip),%eax # 0x48e mov %eax,0x0(%rip) # 0x494 jmp 0x4f8 This sets global variable num1 to int newservice if changeChoice is equal to 1. Compare %eax by 1 Conditional jump that follows previous test mov 0x0(%rip),%eax # 0x49c cmp $0x2,%eax jne 0x4af mov 0x0(%rip),%eax # 0x4a7 mov %eax,0x0(%rip) # 0x4ad jmp 0x4f8 This sets global variable num2 to int newservice if changeChoice is equal to 2. Compare %eax by 2 Conditional jump that follows previous test jump mov 0x0(%rip),%eax # 0x4b5 cmp $0x3,%eax jne 0x4c8 <_Z20ChangeCustomerChoicev+155> mov 0x0(%rip),%eax # 0x4c0 mov %eax,0x0(%rip) # 0x4c6 jmp 0x4f8 This sets global variable num3 to int newservice if changeChoice is equal to 3. Compare %eax by 3 Conditional jump that follows previous test mov 0x0(%rip),%eax # 0x4ce cmp $0x4,%eax jne 0x4e1 mov 0x0(%rip),%eax # 0x4d9 mov %eax,0x0(%rip) # 0x4df jmp 0x4f8 This sets global variable num4 to int newservice if changeChoice is equal to 4. Compare %eax by 4 Conditional jump that follows previous test mov 0x0(%rip),%eax # 0x4e7 cmp $0x5,%eax jne 0x4f8 <_Z20ChangeCustomerChoicev+203> mov 0x0(%rip),%eax # 0x4f2 mov %eax,0x0(%rip) # 0x4f8 nop pop %rbp retq This sets global variable num5 to int newservice if changeChoice is equal to 5. Compare %eax by 5 Conditional jump that follows previous test 4
CheckUserPermissonAccess Function 5
Assembly Code Block Explanation of Functionality push %rbp mov %rsp,%rbp push %rbx sub $0x48,%rsp mov %fs:0x28,%rax mov %rax,-0x18(%rbp) xor %eax,%eax lea -0x45(%rbp),%rax mov %rax,%rdi callq 0x144 lea -0x45(%rbp),%rdx lea -0x40(%rbp),%rax lea 0x0(%rip),%rsi # 0x153 mov %rax,%rdi callq 0x15b lea -0x45(%rbp),%rax mov %rax,%rdi callq 0x167 movl $0x0,-0x44(%rbp) lea 0x0(%rip),%rsi # 0x175 lea 0x0(%rip),%rdi # 0x17c callq 0x181 This starts function, initialize values, and prints out a statement that outputs “ Enter your username Compare Logic -44(%rbp) by 0 Conditional jump that follows previous test lea 0x0(%rip),%rsi # 0x188 lea 0x0(%rip),%rdi # 0x18f callq 0x194 This uses cin to read the users input, then it is assigned into a variable named username. lea 0x0(%rip),%rsi # 0x19b lea 0x0(%rip),%rdi # 0x1a2 callq 0x1a7 This uses a print statement that asks the user for their password. “Enter password” lea -0x40(%rbp),%rax mov %rax,%rsi lea 0x0(%rip),%rdi # 0x1b5 callq 0x1ba lea -0x40(%rbp),%rax lea 0x0(%rip),%rsi # 0x1c5 mov %rax,%rdi callq 0x1cd mov %eax,-0x44(%rbp) cmpl $0x0,-0x44(%rbp) jne 0x1dd mov $0x1,%ebx jmp 0x1e2 mov $0x2,%ebx lea -0x40(%rbp),%rax mov %rax,%rdi callq 0x1ee mov %ebx,%eax mov -0x18(%rbp),%rcx This uses cin to read the users input and stores it in a variable, uses a for loop to check if the username and password are valid. If the username, password or both can not be validated the loop starts back at the beginning. Bitwise operation %rcx in hidden base Jump if equal Jump 6
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
DisplayInfo Function 7
Assembly Code Block Explanation of Functionality push %rbp mov %rsp,%rbp lea 0x0(%rip),%rsi # 0x24c lea 0x0(%rip),%rdi # 0x253 callq 0x258 This Uses a print statement, a message is outputted to indicate which service is selected for a client. Brokerage being choice 1 and Retirement being choice 2 mov %rax,%rdx mov 0x0(%rip),%rax # 0x262 mov %rax,%rsi mov %rdx,%rdi callq 0x26d <_Z11DisplayInfov+44> lea 0x0(%rip),%rsi # 0x274 lea 0x0(%rip),%rdi # 0x27b callq 0x280 <_Z11DisplayInfov+63> lea 0x0(%rip),%rsi # 0x287 mov %rax,%rdi callq 0x28f <_Z11DisplayInfov+78> lea 0x0(%rip),%rsi # 0x296 mov %rax,%rdi callq 0x29e <_Z11DisplayInfov+93> mov %rax,%rdx mov 0x0(%rip),%eax # 0x2a7 mov %eax,%esi mov %rdx,%rdi callq 0x2b1 This uses a print statement, a message such as"1. " << name1 << " selected option " << num1 mov %rax,%rdx mov 0x0(%rip),%rax # 0x2bb mov %rax,%rsi mov %rdx,%rdi callq 0x2c6 <_Z11DisplayInfov+133> lea 0x0(%rip),%rsi # 0x2cd lea 0x0(%rip),%rdi # 0x2d4 callq 0x2d9 <_Z11DisplayInfov+152> lea 0x0(%rip),%rsi # 0x2e0 mov %rax,%rdi callq 0x2e8 <_Z11DisplayInfov+167> lea 0x0(%rip),%rsi # 0x2ef mov %rax,%rdi callq 0x2f7 <_Z11DisplayInfov+182> mov %rax,%rdx mov 0x0(%rip),%eax mov %eax,%esi mov %rdx,%rdi callq 0x30a This uses a print statement, a message such as "2. " << name2 << " selected option " << num2 mov %rax,%rdx mov 0x0(%rip),%rax # 0x314 mov %rax,%rsi mov %rdx,%rdi This uses a print statement, a message such as "3. " << name3 << " selected option " << num3 8
9
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