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

Given the following function written in C programming language and the partially

ID: 3695529 • Letter: G

Question

Given the following function written in C programming language and the partially completed equivalent Assembly code given on the answer page. Complete the assembly language code given on answer page. Please use only the answer sheet and write in the space provided. int Threshold(int *numbers, int count, int threshold) { int i:0; i threshold) numbers [i] = threshold; } } Please use only the space provided for your answer..globl_Threshold_Threshold: pushl %ebp movl %esp.%ebp movl 8(%ebp), %ebx movl 12(%ebp), %ecx movl 16(%ebp), %edx xorl %esi,%esi xorl %edi,%edi //Continue solution here

Explanation / Answer

.Ltext0: .globl Threshold Threshold: .LFB0: .cfi_startproc 0000 55 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 0001 4889E5 movq %rsp, %rbp .cfi_def_cfa_register 6 0004 48897DE8 movq %rdi, -24(%rbp) 0008 8975E4 movl %esi, -28(%rbp) 000b 8955E0 movl %edx, -32(%rbp) 000e C745FC00 movl $0, -4(%rbp) 000000 0015 EB38 jmp .L2 .L4: 0017 8B45FC movl -4(%rbp), %eax 001a 4898 cltq 001c 488D1485 leaq 0(,%rax,4), %rdx 00000000 0024 488B45E8 movq -24(%rbp), %rax 0028 4801D0 addq %rdx, %rax 002b 8B00 movl (%rax), %eax 002d 3B45E0 cmpl -32(%rbp), %eax 0030 7E19 jle .L3 0032 8B45FC movl -4(%rbp), %eax 0035 4898 cltq 0037 488D1485 leaq 0(,%rax,4), %rdx 00000000 003f 488B45E8 movq -24(%rbp), %rax 0043 4801C2 addq %rax, %rdx 0046 8B45E0 movl -32(%rbp), %eax 0049 8902 movl %eax, (%rdx) .L3: 004b 8345FC01 addl $1, -4(%rbp) .L2: 004f 8B45FC movl -4(%rbp), %eax 0052 3B45E4 cmpl -28(%rbp), %eax 0055 7CC0 jl .L4 0057 90 nop 0058 5D popq %rbp .cfi_def_cfa 7, 8 0059 C3 ret .cfi_endproc .LFE0: .Letext0:

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