The code as specified in the steps is as follows:
#include <stdio.h>
/* Main starts here*/
int main(int argc, const char * argv[])
{
unsigned long long label; // 64 bit variable define in C
/* Format string for prompting user for enter an integer*/
char *strprompt="\nPlease enter the value of label: \n";
/* format string for scanning 64 bit integer in C*/
char *strscan="%llu";
/* Format string for diplay integer as is and in hexadecimal notation*/
char *strdisplay="\nThe ORIGINAL INTEGER [%08llu] represented in HEXADECIMAL notation [0x%016llx]\n";
/* calling the functions and repeating the actions*/
for (int i=1;i<=5;i++)
{
printf(strprompt);
scanf(strscan, &label);
printf(strdisplay,label, label);
}
return 0;
}
OUTPUT:
Assembly language 64 bit please ! An example file for set up ==========+ ;| Data Segment...
a) Write the following C function in Assembly. You must follow the System V 64-bit calling convention and use AT&T Syntax notation. long fibonacci (long n) { if (n == 0) return 0; else if (n == 1) return 1; else return (fibonacci (n - 1) + fibonacci (n - 2)); } b) The Windows x86-64 calling convention passes function parameters in the registers RCX, RDX, R8 and R9 and returns values on register RAX. Caller saved registers are: RAX,...
a) Write the following C function in Assembly. You must follow the System V 64-bit calling convention and use AT&T Syntax notation. Note: You cannot change the algorithm in any way so your assembly function must still be recursive. (20 points) long Catalan(long n) { long sum = 0; if (n == 0) return 1; for (int i = 0; i < n; i++) { sum += Catalan(i) * Catalan(n - i - 1); } return sum; } b) The...
The following problem concerns the following, low-quality code: void foo(int x) { int a[3]; char buf[1]; a[1] = x; a[2] = 0xA0B1C2D3; gets(buf); printf("a[0] = 0x%x, a[2] = 0x%x, buf = %s\n", a[0], a[2], buf); } In a program containing this code, procedure foo has the following disassembled form on an x86/64 machine: 000000000040057d <foo>: 40057d: push %rbp 40057e: mov %rsp,%rbp 400581: sub $0x30,%rsp 400585: mov %edi,-0x24(%rbp) 400588: mov -0x24(%rbp),%eax 40058b: mov %eax,-0xc(%rbp) 40058e: movl $0xa0b1c2d3,-0x8(%rbp) 400595: lea -0x11(%rbp),%rax 400599:...