	.global somme
	.global n
        .global calcul

	.bss
somme:	.skip 4
n:	.skip 4

	.text
	@ r0 : i
	@ r1 : j
        @ r2 : copie de somme
        @ r3 : adresse puis copie de n
        @ r4 : adresse de somme


             .ltorg
calcul:	     stmfd  sp!,{r0-r4}      @ code standard de début de fonction

             ldr   r4,= somme        @ somme = 0
             mov   r2,#0
             str   r2,[r4]

corpsfor1:   mov   r0,#1             @ i=1
             b     condw1
corpsw1:                             @ debut corps de for1/while1

initfor2:    mov   r1,r0             @ j=i  
             b     condw2

corpsw2:     ldr   r4,=somme         @ somme = somme + j
             ldr   r2,[r4]
             add   r2,r2,r1
             str   r2,[r4]

finw2:
majfor2:     add   r1,r1,#1          @ j = j+1

condw2:      ldr   r3,=n
             ldr   r3,[r3]
             cmp   r1, r3            @ if (j <=n) goto corpsw2
             ble   corpsw2

finfor2:
majfor1:     add   r0,r0,#1          @ i = i+1
             
condw1:      ldr   r3,=n
             ldr   r3,[r3]
             cmp   r0, r3            @ if (i <=n) goto corpsw1
             ble   corpsw1

             ldmfd  sp!,{r0-r4}	     @ code standard de fin de fonction
             mov   pc,lr
