I want convert the C code to Sparc Assembly include int main

I want convert the C code to Sparc Assembly.

#include<stdio.h>

int main() {

int n;
int i, j, k;
int a[19][19];


while (1) {

  printf(\"input: \");
  scanf(\"%d\", &n);
  if (n % 2 == 0) break;
  if (n < 2) break;
  if (n > 19) break;

  i = 0, j = n / 2;

  for ( k = 1; k <= n*n; k++) {
   a[i][j] = k;
   if (k%n == 0) i++;
   else {
    i--;
    j++;
    if (i == -1) i = n - 1;
    if (j == n) j = 0;
   }
  }
  for (i = 0; i < n; i++) {
   for (j = 0; j < n; j++) {
    printf(\"%3d\", a[i][j]);
   }
   printf(\"\ \");
  }

}

I want start with this code.

              .section “.data”

           n:   .word 0

    fmt0:   .asciz \"%d“

      fmt3:   .asciz \" n input = “

                   .section “.text”

                    .global main

     main:      save    %sp, -96, %sp

                    set    fmt3, %o0

                    call printf

                    nop

                   set    fmt0, %o0

                   set     n, %o1      

                  call   scanf                  

Solution

% cc -g -O inline32.il driver32.c
% er_src a.out main
Source file: /home/AUser/code/inline/driver32.c
Object file: /home/AUser/code/inline/driver32.o
Load Object: a.out

1. #include &lt;stdio.h&gt;
2.
3. void do_nothing();
4. int add_up(int v1,int v2, int v3, int v4, int v5, int v6, int v7);
5. double sum_val(double a, double b);
6. double sum_ref(double *a, double *b);
7. int is_true(int i);
8.
9.
10. void main()
11.
return 0;
}

I want convert the C code to Sparc Assembly. #include<stdio.h> int main() { int n; int i, j, k; int a[19][19]; while (1) { printf(\
I want convert the C code to Sparc Assembly. #include<stdio.h> int main() { int n; int i, j, k; int a[19][19]; while (1) { printf(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site