Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Specifically, you will find 3 functions written in x86-64 Assembly Language below , and your job is to write 3 equivalent functions in C. f2:

Specifically, you will find 3 functions written in x86-64 Assembly Language below, and your job is to write 3 equivalent functions in C.

f2: .LFB12: .cfi_startproc cmpl %edx, %edi sete %dl xorl %eax, %eax cmpl %esi, %edi sete %al andl %edx, %eax ret .cfi_endproc .LFE12: .size f2, .-f2 .p2align 4,,15 .globl f3 .type f3, @function

f4: .LFB14: .cfi_startproc pushq %r12 .cfi_def_cfa_offset 16 .cfi_offset 12, -16 movq %rdi, %r12 pushq %rbp .cfi_def_cfa_offset 24 .cfi_offset 6, -24 movq %r12, %rbp pushq %rbx .cfi_def_cfa_offset 32 .cfi_offset 3, -32 leaq 1(%r12), %rbx call puts movsbl (%r12), %edx testb %dl, %dl je .L15 .p2align 4,,10 .p2align 3 .L17: xorl %eax, %eax movl $122, %ecx movl $97, %esi movl $.LC0, %edi call printf movzbl 0(%rbp), %edx leal -97(%rdx), %eax cmpb $25, %al ja .L11 subl $32, %edx movb %dl, 0(%rbp) .L11: movq %rbx, %rbp addq $1, %rbx movsbl -1(%rbx), %edx testb %dl, %dl jne .L17 .L15: popq %rbx .cfi_def_cfa_offset 24 popq %rbp .cfi_def_cfa_offset 16 movq %r12, %rax popq %r12 .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE14: .size f4, .-f4 .p2align 4,,15 .globl f5 .type f5, @function

f5: .LFB15: .cfi_startproc cmpb $0, (%rdi) movq %rdi, %rax movq %rdi, %rdx je .L32 .p2align 4,,10 .p2align 3 .L22: addq $1, %rdx cmpb $0, (%rdx) jne .L22 movzbl (%rsi), %ecx testb %cl, %cl je .L33 .p2align 4,,10 .p2align 3 .L24: movb %cl, (%rdx) addq $1, %rsi addq $1, %rdx .L32: movzbl (%rsi), %ecx testb %cl, %cl jne .L24 .L33: movb $0, (%rdx) ret .cfi_endproc .LFE15: .size f5, .-f5 .ident "GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-28)" .section .note.GNU-stack,"",@progbits

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

6. Is all Internet training the same? Explain.

Answered: 1 week ago