		.global  calcul

calcul:

@  s: r0
@  rval1, rval2 : r1,r2
@  rad : r5
@  radad : r6

     stmfd	sp!,{r0-r6}

     ldr	r5,= x		@ rad=&x
     ldrsh 	r1,[r5]         @ rval1  *rad
     ldr	r5,= y		@ rad=&y
     ldrsh 	r2,[r5]         @ rval2  *rad
     add	r0,r1,r2	@ s = rval1+rval2

     ldr	r5,=somme	@ rad=&somme
     strh       r0,[r5]         @ *rad=s

     ldr        r6,=adrmax	@ radad=&adrmax
     ldr	r5,=x		@ rad = &x
     str	r5,[r6]		@ *radad = rad

condif:
     @ ces 4 instructions redondantes
     @ rval1 et ravl2 contiennet déjà une copie de x et y

     ldr        r5,= y          @ rad=&y
     ldrsh      r1,[r5]         @ rval1  *rad     
     ldr        r5,= x          @ rad=&x
     ldrsh      r2,[r5]         @ rval2  *rad     

     cmp        r1,r2           @ if (rval1 <= ravl2) goto finif
     ble        finif

     ldr        r6,= adrmax     @ radad = &adrmax
     ldr        r5,= y          @ rad = &y
     str        r5,[r6]         @ *radad = rad

finif:
     ldr        r6,=adrmax      @ radad=&adrmax
     ldr        r5,[r6]         @ rad = *radad
     ldrsh      r1,[r5]         @ ravl1  *rad
     ldr        r5,=max_xy      @ rad = &max_xy
     strh       r1,[r5]         @ *rad=rval1

     stmfd	sp!,{r0-r6}
     bx		lr              @ ou mov  pc,lr

