Homework Assignment 4 CS 340d Unique Number: 50960 Spring, 2019 Given: February 18, 2019 Due: February 27, 2019 1. This problem is an evolution of Problem 1 from HW #3. Our specification remains the same: char *dst, *src; // Set src and dst pointers *dst++ = *src++; This program fragment copies memory bytes from *src to *dst one byte at a time. Unlike Problem 1 from HW #3, we no longer know that the initial value of pointer ``src'' is long-word (8-byte) aligned. If it is, then the solution you produced for Problem 1 of HW #3 should (hopefully) work. But, if the starting point of ``src'' is not 8-byte aligned, then you will need to do some additional work. Your solution should not read each word from the ``src'' more than once. 2. Write C code that performs the x86 function shown. The assembler code below was produced by running ``gcc -O2 -S hw4-re-problems.c'' on a UTCS Linux system. Your task is to produce C-language code that the compiler might have received to produce this output. fun_1: leaq (%rdi,%rdi,8), %rax ret 3. Write C code that performs the x86 function shown. fun_2: .cfi_startproc movq %rdi, %rdx movq %rdi, %rax salq $56, %rdx shrq $56, %rax orq %rdx, %rax movq %rdi, %rdx andl $65280, %edx salq $40, %rdx orq %rdx, %rax movq %rdi, %rdx andl $16711680, %edx salq $24, %rdx orq %rdx, %rax movq %rdi, %rdx andq $-16777216, %rdx salq $8, %rdx orq %rdx, %rax movq %rdi, %rdx shrq $8, %rdx andl $4278190080, %edx orq %rdx, %rax movq %rdi, %rdx shrq $40, %rdi shrq $24, %rdx andl $65280, %edi andl $16711680, %edx orq %rdx, %rax orq %rdi, %rax ret 4. Write C code that performs the x86 function shown. fun_3: .cfi_startproc cmpq %rcx, %rdx movq %rdi, %rax cmovl %rcx, %rdx cmpq %rsi, %rdx cmovge %rdx, %rsi cmpq %rdi, %rsi cmovge %rsi, %rax ret 5. Turn in your C-language code for Part A of Lab #1. This is a way for you to get early feedback on your Lab #1 effort.