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:
![Please enter the value of label: 5 The ORIGINAL INTEGER [ee800805] represented in HEXADECIMAL notation [exe000800000080005] Please enter the value of label: 37 The ORIGINAL INTEGER [00000037] represented in HEXADECIMAL notation [exee0080008000025] Please enter the value of label: 109 The ORIGINAL INTEGER [eee00109] represented in HEXADECIMAL notation [ex00008000000086d] Please enter the value of label: 352 The ORIGINAL INTEGER [e0000352] represented in HEXADECIMAL notation [ex8008088160 Please enter the value of label: 5296 The ORIGINAL INTEGER [00085296] represented in HEXADECIMAL notation [ex00000080014be] Program ended with exit code:e](http://img.homeworklib.com/questions/05e53580-cf35-11ea-8630-91ecb8d82c7b.png?x-oss-process=image/resize,w_560)
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:...
Suppose we have C program, int foo(long s, long d) { char arr_a[11]; int i; arr_a[10] = 0; arr_s[10] = 0; for (i = 0; i < 5; i++) { if ((s == 1) && (d == 2)) { arr_a[i] = hello[4-i]; arr_s[i] = hello[4-i]; arr_a[i+5] = world[i]; arr_s[i+5] = world[i]; } else { arr_a[i+5] = hello[4-i]; arr_s[i+5] = hello[4-i]; arr_a[i] = world[i]; arr_s[i] =...
Task The task for this assignment is to have the following user-defined data type: struct rgb { unsigned char red; unsigned char green; unsigned char blue; }; be able to be: read in from a stream (e.g., std::cin), i.e., write: std::istream& operator >>(std::istream& is, rgb& colour); (see below) written out to a stream (e.g., std::cout), i.e., write: std::ostream& operator <<(std::ostream& os, rgb const& colour); (see below) stored in a container, e.g., std::vector<rgb>, std::array<rgb,16>; (see below) processed via algorithms (and other...