Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Order of operations (Challenge Assignment) Create a program that calculates the

ID: 3590730 • Letter: O

Question

Order of operations (Challenge Assignment) Create a program that calculates the following expression: answer = (A The answer must be stored in a variable of the correct data type given your data 3.4 B) (C D) (C + D) - (A, B, C,D) ·The values for your data (A, B, C, D) must be stored in registers (e.g., eax, ebx), not variables. You must supply the initial values for the data (A, B, c, D). Create a string that could accompany the answer in an output statement e.g, "The answer is:"). You do not have to output the string. Comment each line of code, as demonstrated in the Working Examples Section Program 3.2 for GAS, to briefly describe each line's meaning.

Explanation / Answer

.lcomm __ZStL8__ioinit,1,1

.def ___main; .scl 2; .type 32; .endef

.section .rdata,"dr"

.align 4

LC0:

.ascii "Enter the value of A B C and D : "

LC1:

.ascii "the answer is "

.text

.globl _main

.def _main; .scl 2; .type 32; .endef

_main:

LFB1018:

.cfi_startproc

pushl %ebp #

.cfi_def_cfa_offset 8

.cfi_offset 5, -8

movl %esp, %ebp #,

.cfi_def_cfa_register 5

pushl %ebx #

andl $-16, %esp #,

subl $32, %esp #,

.cfi_offset 3, -12

call ___main #

movl $LC0, 4(%esp) #,

movl $__ZSt4cout, (%esp) #,

call __ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc #

leal 28(%esp), %eax #, tmp96

movl %eax, 4(%esp) # tmp96,

movl $__ZSt3cin, (%esp) #,

call __ZNSirsERi #

movl %eax, %edx #, D.21098

leal 24(%esp), %eax #, tmp97

movl %eax, 4(%esp) # tmp97,

movl %edx, (%esp) # D.21098,

call __ZNSirsERi #

movl %eax, %edx #, D.21098

leal 20(%esp), %eax #, tmp98

movl %eax, 4(%esp) # tmp98,

movl %edx, (%esp) # D.21098,

call __ZNSirsERi #

movl %eax, %edx #, D.21098

leal 16(%esp), %eax #, tmp99

movl %eax, 4(%esp) # tmp99,

movl %edx, (%esp) # D.21098,

call __ZNSirsERi #

movl 28(%esp), %edx # firstNumber, D.21099

movl 24(%esp), %eax # secondNumber, D.21099

leal (%edx,%eax), %ecx #, D.21099

movl 20(%esp), %edx # thirdNumber, D.21099

movl 16(%esp), %eax # forthNumber, D.21099

addl %edx, %eax # D.21099, D.21099

subl %eax, %ecx # D.21099, result

movl %ecx, %ebx # result, result

movl $LC1, 4(%esp) #,

movl $__ZSt4cout, (%esp) #,

call __ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc #

movl %ebx, 4(%esp) # result,

movl %eax, (%esp) # D.21100,

call __ZNSolsEi #

movl $0, %eax #, D.21099

movl -4(%ebp), %ebx #,

leave

.cfi_restore 5

.cfi_restore 3

.cfi_def_cfa 4, 4

ret

.cfi_endproc

LFE1018:

.def __Z41__static_initialization_and_destruction_0ii; .scl 3; .type 32; .endef

__Z41__static_initialization_and_destruction_0ii:

LFB1022:

.cfi_startproc

pushl %ebp #

.cfi_def_cfa_offset 8

.cfi_offset 5, -8

movl %esp, %ebp #,

.cfi_def_cfa_register 5

subl $24, %esp #,

cmpl $1, 8(%ebp) #, __initialize_p

jne L3 #,

cmpl $65535, 12(%ebp) #, __priority

jne L3 #,

movl $__ZStL8__ioinit, (%esp) #,

call __ZNSt8ios_base4InitC1Ev #

movl $___dso_handle, 8(%esp) #,

movl $__ZStL8__ioinit, 4(%esp) #,

movl $__ZNSt8ios_base4InitD1Ev, (%esp) #,

call ___cxa_atexit #

L3:

leave

.cfi_restore 5

.cfi_def_cfa 4, 4

ret

.cfi_endproc

LFE1022:

.def __GLOBAL__sub_I_main; .scl 3; .type 32; .endef

__GLOBAL__sub_I_main:

LFB1023:

.cfi_startproc

pushl %ebp #

.cfi_def_cfa_offset 8

.cfi_offset 5, -8

movl %esp, %ebp #,

.cfi_def_cfa_register 5

subl $24, %esp #,

movl $65535, 4(%esp) #,

movl $1, (%esp) #,

call __Z41__static_initialization_and_destruction_0ii #

leave

.cfi_restore 5

.cfi_def_cfa 4, 4

ret

.cfi_endproc

LFE1023:

.section .ctors,"w"

.align 4

.long __GLOBAL__sub_I_main

.ident "GCC: (GNU) 4.9.3"

.def __ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc; .scl 2; .type 32; .endef

.def __ZNSirsERi; .scl 2; .type 32; .endef

.def __ZNSolsEi; .scl 2; .type 32; .endef

.def __ZNSt8ios_base4InitC1Ev; .scl 2; .type 32; .endef

.def __ZNSt8ios_base4InitD1Ev; .scl 2; .type 32; .endef

.def ___cxa_atexit; .scl 2; .type 32; .endef

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote