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

Parity Flag need be helped Problem 2: Use the following information. Assumptions

ID: 3748811 • Letter: P

Question

Parity Flag need be helped

Problem 2: Use the following information. Assumptions Data type int is 32 bits long Right shifts of signed data are performed arithmetically Forbidden Casting, either explicit or implicit. Relative comparison operators (, =). Division, modulus, and multiplication. Conditionals (if or:), loops, switch statements, function calls, and macro invocations. Allowed operations All bit-level and logic operations * Addition and Subtraction Equality and inequality () only for test case:s

Explanation / Answer

#include <stdio.h>

int main() {
/* Add 10 and 20 and store result into register %eax */
__asm__ ( "movl $10, %eax;"
"movl $20, %ebx;"
"addl %ebx, %eax;"
);

/* Subtract 20 from 10 and store result into register %eax */
__asm__ ( "movl $10, %eax;"
"movl $20, %ebx;"
"subl %ebx, %eax;"
);

/* Multiply 10 and 20 and store result into register %eax */
__asm__ ( "movl $10, %eax;"
"movl $20, %ebx;"
"imull %ebx, %eax;"
);

return 0 ;
}