#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ HTML_LatLongWrite(double, double);
int PIN_VALUE(int);
int /*<<< orphan*/ escribirxy_txt(int, double);
int /*<<< orphan*/ escribirxy_txt_number(int, double, int);
int /*<<< orphan*/ initAnalogPort();
int /*<<< orphan*/ initDigitalPort(int);
int /*<<< orphan*/ plot();
int /*<<< orphan*/ plot_number(int);
int /*<<< orphan*/ printf(char *, ...);
double readADC(int);
int /*<<< orphan*/ sleep(int);
main(void) {
  printf("BEAGLEBONE BLACK.....is alive!\n");
  printf("..............................\n");
  double lat = 0.0;
  double lon = 0.0;
  double analog = 0.0;
  int i = 0;
  int j = 0;
  int k = 0;
  int port = 0;
  int Stop = 0;
  printf("...Se inicializaron las variables...\n");
  initAnalogPort();
  printf("...Se inicializo los puertos analogos\n");
  initDigitalPort(44);
  printf("...Se inicializo el puerto digital 44:P8-12..\n");
  Stop = PIN_VALUE(44);
  printf("...Arrancamos el Ciclo While de lectura analoga....\n");
  printf("....................................................\n");
  printf(" \n");
  printf(" \n");
  while (Stop == 0) {
    printf("\n \n Cargando Data%d.txt \n \n", j);
    while (k < 10) {
      analog = readADC(port);
      escribirxy_txt_number(i, (analog), j);
      escribirxy_txt(i, (analog));
      plot();
      printf(
          "El valor de la concentracion de Metano es %f ppm en el sensor !\n",
          analog);
      i = i + 1;
      k = k + 1;
      sleep(1);
      Stop = PIN_VALUE(44);
      if (Stop == 1) {
        break;
      }
    }
    plot_number(j);
    Stop = PIN_VALUE(44);
    k = 0;
    j = j + 1;
    plot();
  }
  printf("...Se cerro el ciclo...graficando...\n");
  plot();
  printf("...Termino la grafica....\n");
  HTML_LatLongWrite(lat, lon);
  printf("...Generando archivo de HTML con los Mapas....\n");
  printf("...Abriendo Firefox....\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <initAnalogPort@plt>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x2c,%edi
call   1070 <initDigitalPort@plt>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x2c,%edi
call   10b0 <PIN_VALUE@plt>
mov    %eax,-0x34(%rbp)
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x34(%rbp)
jne    136d <main+0x1bd>
mov    -0x28(%rbp),%esi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0xa,-0x2c(%rbp)
jge    133c <main+0x18c>
mov    -0x30(%rbp),%edi
call   1080 <readADC@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%esi
call   10c0 <escribirxy_txt_number@plt>
mov    -0x24(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
call   1030 <escribirxy_txt@plt>
mov    $0x0,%al
call   10a0 <plot@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xe2b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    $0x1,%edi
call   10d0 <sleep@plt>
mov    $0x2c,%edi
call   10b0 <PIN_VALUE@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
jne    1337 <main+0x187>
jmp    133c <main+0x18c>
jmp    12b1 <main+0x101>
mov    -0x28(%rbp),%edi
call   1060 <plot_number@plt>
mov    $0x2c,%edi
call   10b0 <PIN_VALUE@plt>
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   10a0 <plot@plt>
jmp    1296 <main+0xe6>
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   10a0 <plot@plt>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1090 <HTML_LatLongWrite@plt>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe8b(%rip),%rdi
call   1040 <puts@plt>
lea    0xf61(%rip),%rdi
call   1040 <puts@plt>
lea    0xe92(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <initAnalogPort@plt>
lea    0xea4(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2c,%edi
call   1080 <initDigitalPort@plt>
lea    0xeb4(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2c,%edi
call   10c0 <PIN_VALUE@plt>
mov    %eax,%ebx
lea    0xeca(%rip),%rdi
call   1040 <puts@plt>
lea    0xef2(%rip),%rdi
call   1040 <puts@plt>
lea    0xf1b(%rip),%rbp
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
je     12aa <main+0xea>
lea    0xf02(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   10b0 <plot@plt>
lea    0xf14(%rip),%rdi
call   1040 <puts@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   10a0 <HTML_LatLongWrite@plt>
lea    0xf17(%rip),%rdi
call   1040 <puts@plt>
lea    0xf3a(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd6b(%rip),%r15
xor    %r13d,%r13d
xor    %r12d,%r12d
jmp    12ea <main+0x12a>
nopl   0x0(%rax)
mov    %r13d,%edi
call   1070 <plot_number@plt>
mov    $0x2c,%edi
call   10c0 <PIN_VALUE@plt>
mov    %eax,%ebx
add    $0x1,%r13d
xor    %eax,%eax
call   10b0 <plot@plt>
add    %r14d,%r12d
test   %ebx,%ebx
jne    1257 <main+0x97>
xor    %ebp,%ebp
lea    0xd0d(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
nopl   (%rax)
lea    (%r12,%rbp,1),%ebx
xor    %edi,%edi
call   1090 <readADC@plt>
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
mov    %r13d,%esi
call   10d0 <escribirxy_txt_number@plt>
mov    %ebx,%edi
movsd  (%rsp),%xmm0
call   1030 <escribirxy_txt@plt>
xor    %eax,%eax
call   10b0 <plot@plt>
mov    %r15,%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0x1(%rbp),%r14d
mov    $0x1,%edi
call   10e0 <sleep@plt>
mov    $0x2c,%edi
call   10c0 <PIN_VALUE@plt>
cmp    $0x1,%eax
je     12c0 <main+0x100>
cmp    $0x9,%ebp
mov    %r14d,%ebp
jb     1300 <main+0x140>
jmp    12c0 <main+0x100>

LLVM IR (-O0):
@.str = [32 x i8] c"BEAGLEBONE BLACK.....is alive!\0A\00"
@.str.1 = [32 x i8] c"..............................\0A\00"
@.str.2 = [38 x i8] c"...Se inicializaron las variables...\0A\00"
@.str.3 = [39 x i8] c"...Se inicializo los puertos analogos\0A\00"
@.str.4 = [47 x i8] c"...Se inicializo el puerto digital 44:P8-12..\0A\00"
@.str.5 = [53 x i8] c"...Arrancamos el Ciclo While de lectura analoga....\0A\00"
@.str.6 = [54 x i8] c"....................................................\0A\00"
@.str.7 = [3 x i8] c" \0A\00"
@.str.8 = [28 x i8] c"\0A \0A Cargando Data%d.txt \0A \0A\00"
@.str.9 = [65 x i8] c"El valor de la concentracion de Metano es %f ppm en el sensor !\0A\00"
@.str.10 = [38 x i8] c"...Se cerro el ciclo...graficando...\0A\00"
@.str.11 = [27 x i8] c"...Termino la grafica....\0A\00"
@.str.12 = [48 x i8] c"...Generando archivo de HTML con los Mapas....\0A\00"
@.str.13 = [25 x i8] c"...Abriendo Firefox....\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (...) @initAnalogPort()
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @initDigitalPort(i32 44)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @PIN_VALUE(i32 44)
store i32 %17, i32* %9
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %22
22: ; preds = %54, %0
%23 = load i32, i32* %9
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %61
25: ; preds = %22
%26 = load i32, i32* %6
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %53, %25
%29 = load i32, i32* %7
%30 = icmp slt i32 %29, 10
br i1 %30, label %31, label %54
31: ; preds = %28
%32 = load i32, i32* %8
%33 = call double @readADC(i32 %32)
store double %33, double* %4
%34 = load i32, i32* %5
%35 = load double, double* %4
%36 = load i32, i32* %6
%37 = call i32 @escribirxy_txt_number(i32 %34, double %35, i32 %36)
%38 = load i32, i32* %5
%39 = load double, double* %4
%40 = call i32 @escribirxy_txt(i32 %38, double %39)
%41 = call i32 (...) @plot()
%42 = load double, double* %4
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0), double %42)
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %7
%48 = call i32 @sleep(i32 1)
%49 = call i32 @PIN_VALUE(i32 44)
store i32 %49, i32* %9
%50 = load i32, i32* %9
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %53
52: ; preds = %31
br label %54
53: ; preds = %31
br label %28
54: ; preds = %52, %28
%55 = load i32, i32* %6
%56 = call i32 @plot_number(i32 %55)
%57 = call i32 @PIN_VALUE(i32 44)
store i32 %57, i32* %9
store i32 0, i32* %7
%58 = load i32, i32* %6
%59 = add nsw i32 %58, 1
store i32 %59, i32* %6
%60 = call i32 (...) @plot()
br label %22
61: ; preds = %22
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0))
%63 = call i32 (...) @plot()
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0))
%65 = load double, double* %2
%66 = load double, double* %3
%67 = call i32 @HTML_LatLongWrite(double %65, double %66)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.12, i64 0, i64 0))
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.8 = [28 x i8] c"\0A \0A Cargando Data%d.txt \0A \0A\00"
@.str.9 = [65 x i8] c"El valor de la concentracion de Metano es %f ppm en el sensor !\0A\00"
@str = [31 x i8] c"BEAGLEBONE BLACK.....is alive!\00"
@str.14 = [31 x i8] c"..............................\00"
@str.15 = [37 x i8] c"...Se inicializaron las variables...\00"
@str.16 = [38 x i8] c"...Se inicializo los puertos analogos\00"
@str.17 = [46 x i8] c"...Se inicializo el puerto digital 44:P8-12..\00"
@str.18 = [52 x i8] c"...Arrancamos el Ciclo While de lectura analoga....\00"
@str.19 = [53 x i8] c"....................................................\00"
@str.21 = [2 x i8] c" \00"
@str.22 = [37 x i8] c"...Se cerro el ciclo...graficando...\00"
@str.23 = [26 x i8] c"...Termino la grafica....\00"
@str.24 = [47 x i8] c"...Generando archivo de HTML con los Mapas....\00"
@str.25 = [24 x i8] c"...Abriendo Firefox....\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.14, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.15, i64 0, i64 0))
%4 = tail call i32 (...) @initAnalogPort()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.16, i64 0, i64 0))
%6 = tail call i32 @initDigitalPort(i32 44)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.17, i64 0, i64 0))
%8 = tail call i32 @PIN_VALUE(i32 44)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.18, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.19, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.21, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.21, i64 0, i64 0))
%13 = icmp eq i32 %8, 0
br i1 %13, label %14, label %39
14: ; preds = %0, %33
%15 = phi i32 [ %36, %33 ], [ 0, %0 ]
%16 = phi i32 [ %26, %33 ], [ 0, %0 ]
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 %15)
br label %18
18: ; preds = %14, %18
%19 = phi i32 [ %16, %14 ], [ %26, %18 ]
%20 = phi i32 [ 0, %14 ], [ %27, %18 ]
%21 = tail call double @readADC(i32 0)
%22 = tail call i32 @escribirxy_txt_number(i32 %19, double %21, i32 %15)
%23 = tail call i32 @escribirxy_txt(i32 %19, double %21)
%24 = tail call i32 (...) @plot()
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0), double %21)
%26 = add nsw i32 %19, 1
%27 = add nuw nsw i32 %20, 1
%28 = tail call i32 @sleep(i32 1)
%29 = tail call i32 @PIN_VALUE(i32 44)
%30 = icmp ne i32 %29, 1
%31 = icmp ult i32 %20, 9
%32 = select i1 %30, i1 %31, i1 false
br i1 %32, label %18, label %33
33: ; preds = %18
%34 = tail call i32 @plot_number(i32 %15)
%35 = tail call i32 @PIN_VALUE(i32 44)
%36 = add nuw nsw i32 %15, 1
%37 = tail call i32 (...) @plot()
%38 = icmp eq i32 %35, 0
br i1 %38, label %14, label %39
39: ; preds = %33, %0
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.22, i64 0, i64 0))
%41 = tail call i32 (...) @plot()
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.23, i64 0, i64 0))
%43 = tail call i32 @HTML_LatLongWrite(double 0.000000e+00, double 0.000000e+00)
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.24, i64 0, i64 0))
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.25, i64 0, i64 0))
ret i32 0
}