#pragma GCC optimize ("Og")
#include "ArduinoTrace.h"
//volatile int8_t a=2,b=6,c; //c=3
//volatile int8_t a=5,b=6,c; //c=3
volatile int8_t a=2,b=3,c; //c=7
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("INICIO");
//------------- Proceso en alto nivel -------------------
//if (a>=2 && b>5)
// if (a>=2 && b>5)
// {
// goto then1;
// }
// else
// {
// goto else1;
// }
cond1:
// if(a>=2)
// {
// goto cond2;
// }
// else
// {
// goto else1;
// }
asm goto
(
"lds r16,a \n" //r16 <-- (a)
"cpi r16,2 \n" // (a) - 2
"brge %l[cond2] \n"//if a>=2 goto cond2
"jmp %l[else1] \n"//else goto else1
::::cond2,else1
);
cond2:
// if (b>5)
// {
// goto then1;
// }
// else
// {
// goto else1;
// }
asm goto
(
"lds r16,b \n" //r16 <-- (b)
"cpi r16,6 \n" //(b) - 6
"brge %l[then1] \n" //if b>=6 <--> b>5 goto then1
"jmp %l[else1]" //else1 goto else1
::::then1,else1
);
then1:
//{
//c=3;
asm volatile
(
"ldi r16,3 \n"//r16 <-- 3
"sts c,r16"//c <-- 3
);
//}
//goto endif1;
asm goto
(
"jmp %l[endif1]" //goto endif1
::::endif1
);
//else
else1:
//{
//c=7;
asm volatile
(
"ldi r16,7 \n"//r16 <-- 7
"sts c,r16"//c <-- 7
);
//}
endif1:
//--------------------------------------------------------
DUMP(c);
}
void loop() {
}