#pragma GCC optimize ("Og")
#include "ArduinoTrace.h"
volatile int8_t a=5,b=1,c=0; //prueba1
//volatile int8_t a=4,b=1,c=0; //prueba2
//volatile int8_t a=6,b=4,c=0; //prueba3
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
//-------------- PROCESO ------------------------------------
//while(a>=5 && b<4)
// if(a>=5 && b<4){
// goto bodyw;
// }
// else{
// goto endw;
// }
initwc1:
// if(a>=5){
// goto initwc2;
// }
// else{
// goto endw;
// }
asm goto(
"lds r16,a \n" // r16 <-- (a)
"cpi r16,5 \n" // (a) - 5
"brge %l[initwc2] \n" // if a>=5 goto initwc2
"jmp %l[endw]" // else goto endw
::::initwc2,endw
);
initwc2:
// if(b<4){
// goto bodyw;
// }
// else{
// goto endw;
// }
asm goto(
"lds r16,b \n" // r16 <-- (b)
"cpi r16,4 \n" // (b) - 4
"brlt %l[bodyw] \n" // if b<4 goto bodyw
"jmp %l[endw]" //else goto endw
::::bodyw,endw
);
bodyw:
//c=c+b;
asm volatile(
"lds r16,c \n" //r16 <-- (c)
"lds r17,b \n" //r17 <-- (b)
"add r16,r17 \n" //r16 <-- (c) + (b)
"sts c,r16" //c <-- (c) + (b)
);
//b++;
asm volatile(
"lds r16,b \n" //r16 <-- (b)
"inc r16 \n" //r16 <-- (b) + 1
"sts b,r16" //b <-- (b) + 1
);
asm goto(
"jmp %l[initwc1]" //goto initwc1
::::initwc1
);
endw:
//------------------------------------------------------------
DUMP(c);
}
void loop() {
// put your main code here, to run repeatedly:
}