#define ASM
#include "tab.h"

                     .global  t
                     .global  somme
                     .global  f

                     .bss
t:                   .skip  MAX*4
somme:               .skip  4

                     .text

@ r0 : p,  r1 : s, r2 : t + MAX r3 : t  r4 : tmp

f:                   stmfd  sp!,{r0-r4}

                     mov   r1,#0             @ s=0
for:                 ldr   r0,=t             @ p=t
                     ldr   r2,=t+MAX*4       @ t+MAX
                     b     testfor           @ goto test_for
corpsfor:            ldr   r4,[r0]           @ s = s + *p
                     add   r1,r1,r4
                     add   r0,r0,#4          @ p++  (+1*sizeof(unsigned int))
testfor:             cmp   r0,r2             @ if (p<t+MAX) goto corpsfor
                     blo   corpsfor
finfor:
                     ldr   r4,= somme        @ somme = s;
                     str   r1,[r4]

                     ldmfd  sp!,{r0-r4}
                     mov   pc,lr
