Question: // Change the floating files so that they work with double. #include #include #include #include int main(){ char* a; a=(char*)malloc(12*sizeof(char*)); memset(a, 0, 12); printf(please input
// Change the floating files so that they work with double. #include#include #include #include int main(){ char* a; a=(char*)malloc(12*sizeof(char*)); memset(a, 0, 12); printf("please input a number up to 11 digits: "); scanf("%s", a); //for(int i = 0; i < 12; i++) printf("%d\t", a[i]); long long unsigned a_i=0; long long unsigned b=0; long long unsigned c=0; __asm__( "sub %%rax, %%rax;" "sub %%rbx, %%rbx;" "sub %%rcx, %%rcx;" "mov %2, %%rbx;" "more: movzb 0(%%rbx, %%rcx), %%rax;" "inc %%rax;" "dec %%rax;" "jz over;" "subq $48, %%rax;" "addq %%rax, %3;" "inc %%rcx;" "jmp more;" "over: movq %%rcx, %0;" "movq %%rbx, %1;" :"=r"(c), "=r"(b) :"m"(a), "m"(a_i) ); printf("sum: %llu ", a_i); printf("num of digits: %llu ", c); printf("check: "); printf("address of array is %llu ", a); printf("base address in assembly: %llu ", b); free(a); }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
