nchy13 0 Light Poster

hi all. i have implemented Karatsuba algorithm for multiplication of large numbers .
when i compile .c file it is giving correct output using followin commands in linux terminal.
gcc ulti.c
./a.out < hi.txt

But problem arises when i try to run it in ARM using following commands. it give result entirely different than correct answer.
arm-elf-gcc -S ulti.c
arm-elf-gcc ulti.c
arm-elf-run ./a.out < hi.txt.

can anyone shed some light on it. it would be of great help as assignment is due tomorrow.
source file in ARM is given below the c program.
Here is ulti.c(program for karatsuba algorithm)

#include<stdio.h>
#include<string.h>
#define MAX 100
int blah=0;
void sub(char *noo1,char *noo2,char c[])
{

char no1[MAX],no2[MAX];
strcpy(no1,noo1);
strcpy(no2,noo2);


int num1,num2,m,n,l,i,j,k;

num1=strlen(no1);
num2=strlen(no2);


if(num1>=num2)
{
i=num1-num2;
for(k=num2-1;k>=0;k--)
{   no2[k+i]=no2[k];

}   


for(j=0;j<i;j++)
    no2[j]='0';

num1=strlen(no1);
}


else
{i=num2-num1;
for(k=num1-1;k>=0;k--)
    no1[k+i]=no1[k];
for(j=0;j<i;j++)
    no1[j]='0';
    num1=strlen(no2);
    }




for(l=0;l<num1;l++)
{
    c[l]='0';
}
for(l=num1;l<MAX;l++)
    c[l]='\0';

int diff;
for(l=num1-1,m=num1-1;m>=0;l--,m--)
{

    diff=no2[m]-no1[m];

    if(diff<0)
    {
        no2[m-1]--;
        diff+=10;
    }
    c[l]=diff+48;

}
int space=0;

for(i=0;i<strlen(c);i++)
{
    if(c[i]=='0')
        space++;
    else 
        break;
}


if(space>0)
{
    for(i=0;i<MAX;i++)
    {
        if(i<(strlen(c)-space))
            c[i]=c[i+space];
        else
            c[i]='\0';
    }
}


}









void add(char no1[],char no2[],char c[])
{
char noo1[MAX],noo2[MAX];
strcpy(noo1,no1);
strcpy(noo2,no2);

int num1,num2,m,n,l,i,j,k;

num1=strlen(noo1);
num2=strlen(noo2);

if(num1>=num2)
{
i=num1-num2;
for(k=num2-1;k>=0;k--)
{   noo2[k+i]=noo2[k];

}   


for(j=0;j<i;j++)
    noo2[j]='0';
    num1=strlen(noo1);
}
else
{i=num2-num1;
for(k=num1-1;k>=0;k--)
    noo1[k+i]=noo1[k];
for(j=0;j<i;j++)
    noo1[j]='0';
    num1=strlen(noo2);
    }

for(l=0;l<num1+1;l++)
{
    c[l]='0';
}



for(l=num1,m=num1-1;m>=0;l--,m--)
{

    c[l-1]=((c[l]-48 + noo1[m]+noo2[m]-96)/10)+48;


    c[l]=((c[l]-48 + noo1[m]+noo2[m]-96)%10)+48;

}

if(c[0]=='0')
{
    for (i = 0; i < num1; i += 1)
    {
        c[i]=c[i+1];
    }

    c[i]='\0';
}
}





void shift(int size,char a[],int n)
{



    int l;
    for(l=size;l<=size+n-1;l++)
        a[l]='0';
a[size+n]='\0';

}






void cook(char noo1[],char noo2[],char dest[])
{

char no1[MAX],no2[MAX];
strcpy(no1,noo1);
strcpy(no2,noo2);


int num1,num2;
    num1=strlen(no1);
num2=strlen(no2);




    int i,j,k,l;

char dest1[100],dest2[100],dest3[100],m0[100],m1[100],m2[100],n0[MAX],n1[MAX],n2[MAX];  



if(num1>=num2)
{i=num1-num2;
for(k=num2-1;k>=0;k--)
{   no2[k+i]=no2[k];

}   


for(j=0;j<i;j++)
    no2[j]='0';
    num1=strlen(no1);
}
else
{i=num2-num1;
for(k=num1-1;k>=0;k--)
    no1[k+i]=no1[k];
for(j=0;j<i;j++)
    no1[j]='0';
    num1=strlen(no2);
    }




if((num1<=5)&&(num2<=5))
    {


long long int r1,r2,r3;

sscanf(no1,"%lld",&r1);
sscanf(no2,"%lld",&r2);

r3=r1*r2;
sprintf(dest,"%lld",r3);

return;
}



else
{char m00[MAX],m11[MAX],n00[MAX],n11[MAX];


    for(i=0;i<num1/2;i++)
    {


        m00[i]=no1[i];
        n00[i]=no2[i];

    }
        for(i=num1/2,l=0;i<num1;i++,l++)
        {


            m11[l]=no1[i];

            n11[l]=no2[i];


    }



    int l,ll;

    for(i=num1/2;i<MAX;i++)
    {
        m00[i]='\0';
        n00[i]='\0';
    }

    for(i=num1-num1/2;i<MAX;i++)
    {
        m11[i]='\0';
        n11[i]='\0';
    }


    int weight=strlen(m11);


    char des1[MAX],des2[MAX],des3[MAX],dest1[MAX],dest2[MAX],dest3[MAX],m1m0[MAX],n1n0[MAX],m0m2[MAX],n0n2[MAX],m1m2[MAX],n1n2[MAX],aa[MAX],bb[MAX],cc[MAX],fin1[MAX],fin2[MAX],fin3[MAX],m0n0m2n2[MAX],m1n1m2n2[MAX],m1n1m0n0[MAX],fin4[MAX];


    char fm1m0[MAX],fn1n0[MAX],fdest1[MAX],fm1n1m0n0[MAX],faa[MAX],ffdes3[MAX],ffaa[MAX],ffin1[MAX],fdest[100],fdes2[MAX],fdes3[MAX];



    cook(m11,n11,des2);
    strcpy(fdes2,des2);
    cook(m00,n00,des3);
    strcpy(fdes3,des3);


add(m11,m00,m1m0);
strcpy(fm1m0,m1m0);
add(n11,n00,n1n0);
strcpy(fn1n0,n1n0);
cook(m1m0,n1n0,dest1);
strcpy(fdest1,dest1);



    add(des2,des3,m1n1m0n0);
    strcpy(fm1n1m0n0,fm1n1m0n0);
    sub(m1n1m0n0,dest1,aa);
    strcpy(faa,aa);

    shift(strlen(des3),des3,2*weight);
    strcpy(ffdes3,fdes3);
    shift(strlen(aa),aa,weight);
    strcpy(ffaa,faa);

    add(des2,des3,fin1);
    strcpy(ffin1,fin1);
    add(fin1,aa,fdest);
    strcpy(dest,fdest);


    return;








}


int space=0;

for(i=0;i<strlen(dest);i++)
{
    if(dest[i]=='0')
        space++;
    else 
        break;
}


if(space>0)
{
    for(i=0;i<strlen(dest);i++)
    {
        if(i<(strlen(dest)-space))
            dest[i]=dest[i+space];
        else
            dest[i]='\0';
    }
}
}

int main()
 {


char no1[MAX],no2[MAX];



scanf("%s %s",no1,no2);

    char result[MAX];
    cook(no1,no2,result);
    printf("result is %s \n",result);









}

** Here is ulti.s file**

    .file   "ulti.c"
    .global blah
    .bss
    .align  2
    .type   blah, %object
    .size   blah, 4
blah:
    .space  4
    .text
    .align  2
    .global sub
    .type   sub, %function
sub:
    @ args = 0, pretend = 0, frame = 252
    @ frame_needed = 1, uses_anonymous_args = 0
    mov ip, sp
    stmfd   sp!, {fp, ip, lr, pc}
    sub fp, ip, #4
    sub sp, sp, #252
    str r0, [fp, #-16]
    str r1, [fp, #-20]
    str r2, [fp, #-24]
    sub r3, fp, #124
    mov r0, r3
    ldr r1, [fp, #-16]
    bl  strcpy
    sub r3, fp, #224
    mov r0, r3
    ldr r1, [fp, #-20]
    bl  strcpy
    sub r3, fp, #124
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-228]
    sub r3, fp, #224
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-232]
    ldr r2, [fp, #-228]
    ldr r3, [fp, #-232]
    cmp r2, r3
    blt .L2
    ldr r2, [fp, #-228]
    ldr r3, [fp, #-232]
    rsb r3, r3, r2
    str r3, [fp, #-248]
    ldr r3, [fp, #-232]
    sub r3, r3, #1
    str r3, [fp, #-256]
.L3:
    ldr r3, [fp, #-256]
    cmp r3, #0
    blt .L4
    mvn r1, #211
    ldr r3, [fp, #-256]
    sub r0, fp, #12
    add r2, r0, r3
    ldr r3, [fp, #-248]
    add r3, r2, r3
    add r1, r3, r1
    mvn r2, #211
    ldr r3, [fp, #-256]
    sub r0, fp, #12
    add r3, r0, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]
    strb    r3, [r1, #0]
    ldr r3, [fp, #-256]
    sub r3, r3, #1
    str r3, [fp, #-256]
    b   .L3
.L4:
    mov r3, #0
    str r3, [fp, #-252]
.L6:
    ldr r2, [fp, #-252]
    ldr r3, [fp, #-248]
    cmp r2, r3
    bge .L7
    mvn r2, #211
    ldr r3, [fp, #-252]
    sub r1, fp, #12
    add r3, r1, r3
    add r2, r3, r2
    mov r3, #48
    strb    r3, [r2, #0]
    ldr r3, [fp, #-252]
    add r3, r3, #1
    str r3, [fp, #-252]
    b   .L6
.L7:
    sub r3, fp, #124
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-228]
    b   .L9
.L2:
    ldr r2, [fp, #-232]
    ldr r3, [fp, #-228]
    rsb r3, r3, r2
    str r3, [fp, #-248]
    ldr r3, [fp, #-228]
    sub r3, r3, #1
    str r3, [fp, #-256]
.L10:
    ldr r3, [fp, #-256]
    cmp r3, #0
    blt .L11
    mvn r1, #111
    ldr r3, [fp, #-256]
    sub r0, fp, #12
    add r2, r0, r3
    ldr r3, [fp, #-248]
    add r3, r2, r3
    add r1, r3, r1
    mvn r2, #111
    ldr r3, [fp, #-256]
    sub r0, fp, #12
    add r3, r0, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]
    strb    r3, [r1, #0]
    ldr r3, [fp, #-256]
    sub r3, r3, #1
    str r3, [fp, #-256]
    b   .L10
.L11:
    mov r3, #0
    str r3, [fp, #-252]
.L13:
    ldr r2, [fp, #-252]
    ldr r3, [fp, #-248]
    cmp r2, r3
    bge .L14
    mvn r2, #111
    ldr r3, [fp, #-252]
    sub r1, fp, #12
    add r3, r1, r3
    add r2, r3, r2
    mov r3, #48
    strb    r3, [r2, #0]
    ldr r3, [fp, #-252]
    add r3, r3, #1
    str r3, [fp, #-252]
    b   .L13
.L14:
    sub r3, fp, #224
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-228]
.L9:
    mov r3, #0
    str r3, [fp, #-244]
.L16:
    ldr r2, [fp, #-244]
    ldr r3, [fp, #-228]
    cmp r2, r3
    bge .L17
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-244]
    add r2, r2, r3
    mov r3, #48
    strb    r3, [r2, #0]
    ldr r3, [fp, #-244]
    add r3, r3, #1
    str r3, [fp, #-244]
    b   .L16
.L17:
    ldr r3, [fp, #-228]
    str r3, [fp, #-244]
.L19:
    ldr r3, [fp, #-244]
    cmp r3, #99
    bgt .L20
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-244]
    add r2, r2, r3
    mov r3, #0
    strb    r3, [r2, #0]
    ldr r3, [fp, #-244]
    add r3, r3, #1
    str r3, [fp, #-244]
    b   .L19
.L20:
    ldr r3, [fp, #-228]
    sub r3, r3, #1
    str r3, [fp, #-244]
    ldr r3, [fp, #-228]
    sub r3, r3, #1
    str r3, [fp, #-236]
.L22:
    ldr r3, [fp, #-236]
    cmp r3, #0
    blt .L23
    mvn r2, #211
    ldr r3, [fp, #-236]
    sub r0, fp, #12
    add r3, r0, r3
    add r3, r3, r2
    ldrb    r1, [r3, #0]    @ zero_extendqisi2
    mvn r2, #111
    ldr r3, [fp, #-236]
    sub r0, fp, #12
    add r3, r0, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]    @ zero_extendqisi2
    rsb r3, r3, r1
    str r3, [fp, #-260]
    ldr r3, [fp, #-260]
    cmp r3, #0
    bge .L25
    mvn r2, #212
    ldr r3, [fp, #-236]
    sub r1, fp, #12
    add r3, r1, r3
    add r1, r3, r2
    mvn r2, #212
    ldr r3, [fp, #-236]
    sub r0, fp, #12
    add r3, r0, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]
    sub r3, r3, #1
    strb    r3, [r1, #0]
    ldr r3, [fp, #-260]
    add r3, r3, #10
    str r3, [fp, #-260]
.L25:
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-244]
    add r2, r2, r3
    ldr r3, [fp, #-260]
    add r3, r3, #48
    strb    r3, [r2, #0]
    ldr r3, [fp, #-244]
    sub r3, r3, #1
    str r3, [fp, #-244]
    ldr r3, [fp, #-236]
    sub r3, r3, #1
    str r3, [fp, #-236]
    b   .L22
.L23:
    mov r3, #0
    str r3, [fp, #-264]
    mov r3, #0
    str r3, [fp, #-248]
.L26:
    ldr r0, [fp, #-24]
    bl  strlen
    mov r3, r0
    mov r2, r3
    ldr r3, [fp, #-248]
    cmp r3, r2
    bcs .L27
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-248]
    add r3, r2, r3
    ldrb    r3, [r3, #0]    @ zero_extendqisi2
    cmp r3, #48
    bne .L27
    ldr r3, [fp, #-264]
    add r3, r3, #1
    str r3, [fp, #-264]
    ldr r3, [fp, #-248]
    add r3, r3, #1
    str r3, [fp, #-248]
    b   .L26
.L27:
    ldr r3, [fp, #-264]
    cmp r3, #0
    ble .L1
    mov r3, #0
    str r3, [fp, #-248]
.L32:
    ldr r3, [fp, #-248]
    cmp r3, #99
    bgt .L1
    ldr r0, [fp, #-24]
    bl  strlen
    mov r3, r0
    mov r2, r3
    ldr r3, [fp, #-264]
    rsb r2, r3, r2
    ldr r3, [fp, #-248]
    cmp r3, r2
    bcs .L35
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-248]
    add r1, r2, r3
    ldr r2, [fp, #-248]
    ldr r3, [fp, #-24]
    add r2, r2, r3
    ldr r3, [fp, #-264]
    add r3, r2, r3
    ldrb    r3, [r3, #0]
    strb    r3, [r1, #0]
    b   .L34
.L35:
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-248]
    add r2, r2, r3
    mov r3, #0
    strb    r3, [r2, #0]
.L34:
    ldr r3, [fp, #-248]
    add r3, r3, #1
    str r3, [fp, #-248]
    b   .L32
.L1:
    sub sp, fp, #12
    ldmfd   sp, {fp, sp, pc}
    .size   sub, .-sub
    .align  2
    .global add
    .type   add, %function
add:
    @ args = 0, pretend = 0, frame = 244
    @ frame_needed = 1, uses_anonymous_args = 0
    mov ip, sp
    stmfd   sp!, {fp, ip, lr, pc}
    sub fp, ip, #4
    sub sp, sp, #244
    str r0, [fp, #-16]
    str r1, [fp, #-20]
    str r2, [fp, #-24]
    sub r3, fp, #124
    mov r0, r3
    ldr r1, [fp, #-16]
    bl  strcpy
    sub r3, fp, #224
    mov r0, r3
    ldr r1, [fp, #-20]
    bl  strcpy
    sub r3, fp, #124
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-228]
    sub r3, fp, #224
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-232]
    ldr r2, [fp, #-228]
    ldr r3, [fp, #-232]
    cmp r2, r3
    blt .L38
    ldr r2, [fp, #-228]
    ldr r3, [fp, #-232]
    rsb r3, r3, r2
    str r3, [fp, #-248]
    ldr r3, [fp, #-232]
    sub r3, r3, #1
    str r3, [fp, #-256]
.L39:
    ldr r3, [fp, #-256]
    cmp r3, #0
    blt .L40
    mvn r1, #211
    ldr r3, [fp, #-256]
    sub r0, fp, #12
    add r2, r0, r3
    ldr r3, [fp, #-248]
    add r3, r2, r3
    add r1, r3, r1
    mvn r2, #211
    ldr r3, [fp, #-256]
    sub ip, fp, #12
    add r3, ip, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]
    strb    r3, [r1, #0]
    ldr r3, [fp, #-256]
    sub r3, r3, #1
    str r3, [fp, #-256]
    b   .L39
.L40:
    mov r3, #0
    str r3, [fp, #-252]
.L42:
    ldr r2, [fp, #-252]
    ldr r3, [fp, #-248]
    cmp r2, r3
    bge .L43
    mvn r2, #211
    ldr r3, [fp, #-252]
    sub r0, fp, #12
    add r3, r0, r3
    add r2, r3, r2
    mov r3, #48
    strb    r3, [r2, #0]
    ldr r3, [fp, #-252]
    add r3, r3, #1
    str r3, [fp, #-252]
    b   .L42
.L43:
    sub r3, fp, #124
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-228]
    b   .L45
.L38:
    ldr r2, [fp, #-232]
    ldr r3, [fp, #-228]
    rsb r3, r3, r2
    str r3, [fp, #-248]
    ldr r3, [fp, #-228]
    sub r3, r3, #1
    str r3, [fp, #-256]
.L46:
    ldr r3, [fp, #-256]
    cmp r3, #0
    blt .L47
    mvn r1, #111
    ldr r3, [fp, #-256]
    sub ip, fp, #12
    add r2, ip, r3
    ldr r3, [fp, #-248]
    add r3, r2, r3
    add r1, r3, r1
    mvn r2, #111
    ldr r3, [fp, #-256]
    sub r0, fp, #12
    add r3, r0, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]
    strb    r3, [r1, #0]
    ldr r3, [fp, #-256]
    sub r3, r3, #1
    str r3, [fp, #-256]
    b   .L46
.L47:
    mov r3, #0
    str r3, [fp, #-252]
.L49:
    ldr r2, [fp, #-252]
    ldr r3, [fp, #-248]
    cmp r2, r3
    bge .L50
    mvn r2, #111
    ldr r3, [fp, #-252]
    sub r1, fp, #12
    add r3, r1, r3
    add r2, r3, r2
    mov r3, #48
    strb    r3, [r2, #0]
    ldr r3, [fp, #-252]
    add r3, r3, #1
    str r3, [fp, #-252]
    b   .L49
.L50:
    sub r3, fp, #224
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-228]
.L45:
    mov r3, #0
    str r3, [fp, #-244]
.L52:
    ldr r3, [fp, #-228]
    add r2, r3, #1
    ldr r3, [fp, #-244]
    cmp r2, r3
    ble .L53
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-244]
    add r2, r2, r3
    mov r3, #48
    strb    r3, [r2, #0]
    ldr r3, [fp, #-244]
    add r3, r3, #1
    str r3, [fp, #-244]
    b   .L52
.L53:
    ldr r3, [fp, #-228]
    str r3, [fp, #-244]
    ldr r3, [fp, #-228]
    sub r3, r3, #1
    str r3, [fp, #-236]
.L55:
    ldr r3, [fp, #-236]
    cmp r3, #0
    blt .L56
    mvn r1, #0
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-244]
    add r3, r2, r3
    add r0, r3, r1
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-244]
    add r3, r2, r3
    ldrb    r1, [r3, #0]    @ zero_extendqisi2
    mvn r2, #111
    ldr r3, [fp, #-236]
    sub ip, fp, #12
    add r3, ip, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]    @ zero_extendqisi2
    add r1, r1, r3
    mvn r2, #211
    ldr r3, [fp, #-236]
    sub ip, fp, #12
    add r3, ip, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]    @ zero_extendqisi2
    add r3, r1, r3
    sub r1, r3, #144
    ldr r3, .L62
    smull   r2, r3, r1, r3
    mov r2, r3, asr #2
    mov r3, r1, asr #31
    rsb r3, r3, r2
    add r3, r3, #48
    strb    r3, [r0, #0]
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-244]
    add r0, r2, r3
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-244]
    add r3, r2, r3
    ldrb    r1, [r3, #0]    @ zero_extendqisi2
    mvn r2, #111
    ldr r3, [fp, #-236]
    sub ip, fp, #12
    add r3, ip, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]    @ zero_extendqisi2
    add r1, r1, r3
    mvn r2, #211
    ldr r3, [fp, #-236]
    sub ip, fp, #12
    add r3, ip, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]    @ zero_extendqisi2
    add r3, r1, r3
    sub r1, r3, #144
    ldr r3, .L62
    smull   r2, r3, r1, r3
    mov r2, r3, asr #2
    mov r3, r1, asr #31
    rsb r2, r3, r2
    mov r3, r2
    mov r3, r3, asl #2
    add r3, r3, r2
    mov r3, r3, asl #1
    rsb r3, r3, r1
    add r3, r3, #48
    strb    r3, [r0, #0]
    ldr r3, [fp, #-244]
    sub r3, r3, #1
    str r3, [fp, #-244]
    ldr r3, [fp, #-236]
    sub r3, r3, #1
    str r3, [fp, #-236]
    b   .L55
.L56:
    ldr r3, [fp, #-24]
    ldrb    r3, [r3, #0]    @ zero_extendqisi2
    cmp r3, #48
    bne .L37
    mov r3, #0
    str r3, [fp, #-248]
.L59:
    ldr r2, [fp, #-248]
    ldr r3, [fp, #-228]
    cmp r2, r3
    bge .L60
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-248]
    add r0, r2, r3
    mov r1, #1
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-248]
    add r3, r2, r3
    add r3, r3, r1
    ldrb    r3, [r3, #0]
    strb    r3, [r0, #0]
    ldr r3, [fp, #-248]
    add r3, r3, #1
    str r3, [fp, #-248]
    b   .L59
.L60:
    ldr r2, [fp, #-24]
    ldr r3, [fp, #-248]
    add r2, r2, r3
    mov r3, #0
    strb    r3, [r2, #0]
.L37:
    sub sp, fp, #12
    ldmfd   sp, {fp, sp, pc}
.L63:
    .align  2
.L62:
    .word   1717986919
    .size   add, .-add
    .align  2
    .global shift
    .type   shift, %function
shift:
    @ args = 0, pretend = 0, frame = 16
    @ frame_needed = 1, uses_anonymous_args = 0
    mov ip, sp
    stmfd   sp!, {fp, ip, lr, pc}
    sub fp, ip, #4
    sub sp, sp, #16
    str r0, [fp, #-16]
    str r1, [fp, #-20]
    str r2, [fp, #-24]
    ldr r3, [fp, #-16]
    str r3, [fp, #-28]
.L65:
    ldr r2, [fp, #-16]
    ldr r3, [fp, #-24]
    add r3, r2, r3
    sub r2, r3, #1
    ldr r3, [fp, #-28]
    cmp r2, r3
    blt .L66
    ldr r2, [fp, #-20]
    ldr r3, [fp, #-28]
    add r2, r2, r3
    mov r3, #48
    strb    r3, [r2, #0]
    ldr r3, [fp, #-28]
    add r3, r3, #1
    str r3, [fp, #-28]
    b   .L65
.L66:
    ldr r2, [fp, #-16]
    ldr r3, [fp, #-20]
    add r2, r2, r3
    ldr r3, [fp, #-24]
    add r2, r2, r3
    mov r3, #0
    strb    r3, [r2, #0]
    sub sp, fp, #12
    ldmfd   sp, {fp, sp, pc}
    .size   shift, .-shift
    .section    .rodata
    .align  2
.LC0:
    .ascii  "%lld\000"
    .text
    .align  2
    .global cook
    .type   cook, %function
cook:
    @ args = 0, pretend = 0, frame = 4872
    @ frame_needed = 1, uses_anonymous_args = 0
    mov ip, sp
    stmfd   sp!, {r4, fp, ip, lr, pc}
    sub fp, ip, #4
    sub sp, sp, #4864
    sub sp, sp, #8
    str r0, [fp, #-20]
    str r1, [fp, #-24]
    str r2, [fp, #-28]
    sub r3, fp, #128
    mov r0, r3
    ldr r1, [fp, #-20]
    bl  strcpy
    sub r3, fp, #228
    mov r0, r3
    ldr r1, [fp, #-24]
    bl  strcpy
    sub r3, fp, #128
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-232]
    sub r3, fp, #228
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-236]
    ldr r2, [fp, #-232]
    ldr r3, [fp, #-236]
    cmp r2, r3
    blt .L69
    ldr r2, [fp, #-232]
    ldr r3, [fp, #-236]
    rsb r3, r3, r2
    str r3, [fp, #-240]
    ldr r3, [fp, #-236]
    sub r3, r3, #1
    str r3, [fp, #-248]
.L70:
    ldr r3, [fp, #-248]
    cmp r3, #0
    blt .L71
    mvn r1, #211
    ldr r3, [fp, #-248]
    sub r0, fp, #16
    add r2, r0, r3
    ldr r3, [fp, #-240]
    add r3, r2, r3
    add r1, r3, r1
    mvn r2, #211
    ldr r3, [fp, #-248]
    sub r0, fp, #16
    add r3, r0, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]
    strb    r3, [r1, #0]
    ldr r3, [fp, #-248]
    sub r3, r3, #1
    str r3, [fp, #-248]
    b   .L70
.L71:
    mov r3, #0
    str r3, [fp, #-244]
.L73:
    ldr r2, [fp, #-244]
    ldr r3, [fp, #-240]
    cmp r2, r3
    bge .L74
    mvn r2, #211
    ldr r3, [fp, #-244]
    sub r1, fp, #16
    add r3, r1, r3
    add r2, r3, r2
    mov r3, #48
    strb    r3, [r2, #0]
    ldr r3, [fp, #-244]
    add r3, r3, #1
    str r3, [fp, #-244]
    b   .L73
.L74:
    sub r3, fp, #128
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-232]
    b   .L76
.L69:
    ldr r2, [fp, #-236]
    ldr r3, [fp, #-232]
    rsb r3, r3, r2
    str r3, [fp, #-240]
    ldr r3, [fp, #-232]
    sub r3, r3, #1
    str r3, [fp, #-248]
.L77:
    ldr r3, [fp, #-248]
    cmp r3, #0
    blt .L78
    mvn r1, #111
    ldr r3, [fp, #-248]
    sub r0, fp, #16
    add r2, r0, r3
    ldr r3, [fp, #-240]
    add r3, r2, r3
    add r1, r3, r1
    mvn r2, #111
    ldr r3, [fp, #-248]
    sub r0, fp, #16
    add r3, r0, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]
    strb    r3, [r1, #0]
    ldr r3, [fp, #-248]
    sub r3, r3, #1
    str r3, [fp, #-248]
    b   .L77
.L78:
    mov r3, #0
    str r3, [fp, #-244]
.L80:
    ldr r2, [fp, #-244]
    ldr r3, [fp, #-240]
    cmp r2, r3
    bge .L81
    mvn r2, #111
    ldr r3, [fp, #-244]
    sub r1, fp, #16
    add r3, r1, r3
    add r2, r3, r2
    mov r3, #48
    strb    r3, [r2, #0]
    ldr r3, [fp, #-244]
    add r3, r3, #1
    str r3, [fp, #-244]
    b   .L80
.L81:
    sub r3, fp, #228
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-232]
.L76:
    ldr r3, [fp, #-232]
    cmp r3, #5
    bgt .L83
    ldr r3, [fp, #-236]
    cmp r3, #5
    bgt .L83
    sub r2, fp, #128
    sub r3, fp, #1152
    sub r3, r3, #8
    mov r0, r2
    ldr r1, .L108
    mov r2, r3
    bl  sscanf
    sub r3, fp, #228
    sub r2, fp, #1168
    mov r0, r3
    ldr r1, .L108
    bl  sscanf
    mvn r3, #1152
    sub r3, r3, #7
    sub r2, fp, #16
    add r4, r2, r3
    mvn r3, #1136
    sub r3, r3, #7
    sub r0, fp, #16
    add lr, r0, r3
    mov r3, #-1207959552
    mov r3, r3, asr #20
    sub r1, fp, #16
    add ip, r1, r3
    ldr r2, [lr, #0]
    ldr r3, [ip, #0]
    umull   r0, r1, r2, r3
    ldr r2, [lr, #0]
    ldr r3, [ip, #4]
    mul r2, r3, r2
    mov r3, r1
    add r3, r3, r2
    ldr ip, [ip, #0]
    ldr r2, [lr, #4]
    mul r2, ip, r2
    add r3, r3, r2
    mov r1, r3
    stmia   r4, {r0-r1}
    mvn r3, #1152
    sub r3, r3, #7
    sub r2, fp, #16
    add r3, r2, r3
    ldr r0, [fp, #-28]
    ldr r1, .L108
    ldmia   r3, {r2-r3}
    bl  sprintf
    b   .L68
.L83:
    mov r3, #0
    str r3, [fp, #-240]
.L85:
    ldr r2, [fp, #-232]
    mov r3, r2, asr #31
    mov r3, r3, lsr #31
    add r3, r2, r3
    mov r2, r3, asr #1
    ldr r3, [fp, #-240]
    cmp r2, r3
    ble .L86
    mvn r3, #1248
    sub r3, r3, #11
    ldr r2, [fp, #-240]
    sub r0, fp, #16
    add r2, r0, r2
    add r1, r2, r3
    mvn r2, #111
    ldr r3, [fp, #-240]
    sub r0, fp, #16
    add r3, r0, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]
    strb    r3, [r1, #0]
    mvn r3, #1456
    sub r3, r3, #3
    ldr r2, [fp, #-240]
    sub r1, fp, #16
    add r2, r1, r2
    add r1, r2, r3
    mvn r2, #211
    ldr r3, [fp, #-240]
    sub r0, fp, #16
    add r3, r0, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]
    strb    r3, [r1, #0]
    ldr r3, [fp, #-240]
    add r3, r3, #1
    str r3, [fp, #-240]
    b   .L85
.L86:
    ldr r2, [fp, #-232]
    mov r3, r2, asr #31
    mov r3, r3, lsr #31
    add r3, r2, r3
    mov r3, r3, asr #1
    str r3, [fp, #-240]
    mov r3, #0
    str r3, [fp, #-252]
.L88:
    ldr r2, [fp, #-240]
    ldr r3, [fp, #-232]
    cmp r2, r3
    bge .L89
    mov r3, #-1426063360
    mov r3, r3, asr #20
    ldr r2, [fp, #-252]
    sub r1, fp, #16
    add r2, r1, r2
    add r1, r2, r3
    mvn r2, #111
    ldr r3, [fp, #-240]
    sub r0, fp, #16
    add r3, r0, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]
    strb    r3, [r1, #0]
    mvn r3, #1552
    sub r3, r3, #7
    ldr r2, [fp, #-252]
    sub r1, fp, #16
    add r2, r1, r2
    add r1, r2, r3
    mvn r2, #211
    ldr r3, [fp, #-240]
    sub r0, fp, #16
    add r3, r0, r3
    add r3, r3, r2
    ldrb    r3, [r3, #0]
    strb    r3, [r1, #0]
    ldr r3, [fp, #-240]
    add r3, r3, #1
    str r3, [fp, #-240]
    ldr r3, [fp, #-252]
    add r3, r3, #1
    str r3, [fp, #-252]
    b   .L88
.L89:
    ldr r2, [fp, #-232]
    mov r3, r2, asr #31
    mov r3, r3, lsr #31
    add r3, r2, r3
    mov r3, r3, asr #1
    str r3, [fp, #-240]
.L91:
    ldr r3, [fp, #-240]
    cmp r3, #99
    bgt .L92
    mvn r3, #1248
    sub r3, r3, #11
    ldr r2, [fp, #-240]
    sub r1, fp, #16
    add r2, r1, r2
    add r2, r2, r3
    mov r3, #0
    strb    r3, [r2, #0]
    mvn r3, #1456
    sub r3, r3, #3
    ldr r2, [fp, #-240]
    sub r0, fp, #16
    add r2, r0, r2
    add r2, r2, r3
    mov r3, #0
    strb    r3, [r2, #0]
    ldr r3, [fp, #-240]
    add r3, r3, #1
    str r3, [fp, #-240]
    b   .L91
.L92:
    ldr r2, [fp, #-232]
    mov r3, r2, asr #31
    mov r3, r3, lsr #31
    add r3, r2, r3
    mov r2, r3, asr #1
    ldr r3, [fp, #-232]
    rsb r3, r2, r3
    str r3, [fp, #-240]
.L94:
    ldr r3, [fp, #-240]
    cmp r3, #99
    bgt .L95
    mov r3, #-1426063360
    mov r3, r3, asr #20
    ldr r2, [fp, #-240]
    sub r1, fp, #16
    add r2, r1, r2
    add r2, r2, r3
    mov r3, #0
    strb    r3, [r2, #0]
    mvn r3, #1552
    sub r3, r3, #7
    ldr r2, [fp, #-240]
    sub r0, fp, #16
    add r2, r0, r2
    add r2, r2, r3
    mov r3, #0
    strb    r3, [r2, #0]
    ldr r3, [fp, #-240]
    add r3, r3, #1
    str r3, [fp, #-240]
    b   .L94
.L95:
    sub r3, fp, #1376
    mov r0, r3
    bl  strlen
    mov r3, r0
    str r3, [fp, #-1588]
    sub r1, fp, #1376
    sub r2, fp, #1568
    sub r2, r2, #8
    sub r3, fp, #1776
    sub r3, r3, #12
    mov r0, r1
    mov r1, r2
    mov r2, r3
    bl  cook
    sub r2, fp, #4736
    sub r2, r2, #16
    sub r2, r2, #36
    sub r3, fp, #1776
    sub r3, r3, #12
    mov r0, r2
    mov r1, r3
    bl  strcpy
    sub r2, fp, #1264
    sub r2, r2, #12
    sub r3, fp, #1472
    sub r3, r3, #4
    sub ip, fp, #1888
    mov r0, r2
    mov r1, r3
    mov r2, ip
    bl  cook
    sub r3, fp, #4864
    sub r3, r3, #16
    sub r3, r3, #8
    sub r2, fp, #1888
    mov r0, r3
    mov r1, r2
    bl  strcpy
    sub r1, fp, #1376
    sub r3, fp, #1264
    sub r3, r3, #12
    sub r2, fp, #2288
    mov r0, r1
    mov r1, r3
    bl  add
    sub r3, fp, #3888
    sub r2, fp, #2288
    mov r0, r3
    mov r1, r2
    bl  strcpy
    sub r1, fp, #1568
    sub r1, r1, #8
    sub r2, fp, #1472
    sub r2, r2, #4
    sub r3, fp, #2384
    sub r3, r3, #4
    mov r0, r1
    mov r1, r2
    mov r2, r3
    bl  add
    sub r2, fp, #3984
    sub r2, r2, #4
    sub r3, fp, #2384
    sub r3, r3, #4
    mov r0, r2
    mov r1, r3
    bl  strcpy
    sub r1, fp, #2288
    sub r2, fp, #2384
    sub r2, r2, #4
    sub r3, fp, #1984
    sub r3, r3, #4
    mov r0, r1
    mov r1, r2
    mov r2, r3
    bl  cook
    sub r2, fp, #4080
    sub r2, r2, #8
    sub r3, fp, #1984
    sub r3, r3, #4
    mov r0, r2
    mov r1, r3
    bl  strcpy
    sub r2, fp, #1776
    sub r2, r2, #12
    sub r1, fp, #1888
    sub r3, fp, #3680
    sub r3, r3, #8
    mov r0, r2
    mov r2, r3
    bl  add
    sub r1, fp, #3680
    sub r1, r1, #8
    sub r2, fp, #1984
    sub r2, r2, #4
    sub r3, fp, #2880
    sub r3, r3, #8
    mov r0, r1
    mov r1, r2
    mov r2, r3
    bl  sub
    sub r2, fp, #4224
    sub r2, r2, #16
    sub r2, r2, #48
    sub r3, fp, #2880
    sub r3, r3, #8
    mov r0, r2
    mov r1, r3
    bl  strcpy
    sub r3, fp, #1888
    mov r0, r3
    bl  strlen
    mov r3, r0
    mov r2, r3
    sub r1, fp, #1888
    ldr r3, [fp, #-1588]
    mov r3, r3, asl #1
    mov r0, r2
    mov r2, r3
    bl  shift
    sub r2, fp, #4352
    sub r2, r2, #16
    sub r2, r2, #20
    sub r3, fp, #4864
    sub r3, r3, #16
    sub r3, r3, #8
    mov r0, r2
    mov r1, r3
    bl  strcpy
    sub r3, fp, #2880
    sub r3, r3, #8
    mov r0, r3
    bl  strlen
    mov r3, r0
    mov r2, r3
    sub r3, fp, #2880
    sub r3, r3, #8
    mov r0, r2
    mov r1, r3
    ldr r2, [fp, #-1588]
    bl  shift
    sub r2, fp, #4416
    sub r2, r2, #16
    sub r2, r2, #56
    sub r3, fp, #4224
    sub r3, r3, #16
    sub r3, r3, #48
    mov r0, r2
    mov r1, r3
    bl  strcpy
    sub r2, fp, #1776
    sub r2, r2, #12
    sub r1, fp, #1888
    sub r3, fp, #3184
    sub r3, r3, #4
    mov r0, r2
    mov r2, r3
    bl  add
    sub r2, fp, #4544
    sub r2, r2, #16
    sub r2, r2, #28
    sub r3, fp, #3184
    sub r3, r3, #4
    mov r0, r2
    mov r1, r3
    bl  strcpy
    sub r2, fp, #3184
    sub r2, r2, #4
    sub r3, fp, #2880
    sub r3, r3, #8
    sub ip, fp, #4672
    sub ip, ip, #16
    mov r0, r2
    mov r1, r3
    mov r2, ip
    bl  add
    sub r3, fp, #4672
    sub r3, r3, #16
    ldr r0, [fp, #-28]
    mov r1, r3
    bl  strcpy
.L68:
    sub sp, fp, #16
    ldmfd   sp, {r4, fp, sp, pc}
.L109:
    .align  2
.L108:
    .word   .LC0
    .size   cook, .-cook
    .section    .rodata
    .align  2
.LC1:
    .ascii  "%s %s\000"
    .align  2
.LC2:
    .ascii  "result is %s \n\000"
    .text
    .align  2
    .global main
    .type   main, %function
main:
    @ args = 0, pretend = 0, frame = 300
    @ frame_needed = 1, uses_anonymous_args = 0
    mov ip, sp
    stmfd   sp!, {fp, ip, lr, pc}
    sub fp, ip, #4
    sub sp, sp, #300
    sub r3, fp, #112
    sub r2, fp, #212
    ldr r0, .L111
    mov r1, r3
    bl  scanf
    sub r3, fp, #112
    sub r2, fp, #212
    sub ip, fp, #312
    mov r0, r3
    mov r1, r2
    mov r2, ip
    bl  cook
    sub r3, fp, #312
    ldr r0, .L111+4
    mov r1, r3
    bl  printf
    mov r0, r3
    sub sp, fp, #12
    ldmfd   sp, {fp, sp, pc}
.L112:
    .align  2
.L111:
    .word   .LC1
    .word   .LC2
    .size   main, .-main
    .ident  "GCC: (GNU) 3.4.3"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.