#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*/ GPIODirection(int, int);
int /*<<< orphan*/ GPIOExport(int);
scalar_t__ GPIORead(int);
int GPIOUnexport(int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int botao[3] = {5, 6, 13};
  int matriz[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
  int selec = 0;
  do {
    printf("\nDeseja Iniciar o Programa ? S[1]/N[2]\t");
    scanf("%d", &selec);
    if (selec == 1)
      break;
    else {
      if (GPIOUnexport(5) == 1 && GPIOUnexport(6) == 1 &&
          GPIOUnexport(13) == 1) {
        printf("Programa Encerrado com Sucesso! \n");
        getchar();
        return 0;
      } else {
        printf("\n\tHouve Erros ao encerrar o programa!\n\tVerifique os "
               "Terminais GPIO!\n");
        return 0;
      }
    }
  } while (selec > 0 && selec < 3);
  for (int count = 0; count < 3; count++) {
    GPIOExport(botao[count]);
    GPIODirection(botao[count], 1);
  }
  int countL = 0, countC = 0;
  while (1) {
    int selecL = 0;
    printf("Digite a Linha para Verificar o Botão!\n");
    do {
      scanf("%d", &selecL);
    } while (selecL >= 0 && selecL < 3);
    if (selecL == 0) {
      matriz[selecL][0] = (int)GPIORead(botao[0]);
      matriz[selecL][1] = (int)GPIORead(botao[1]);
      matriz[selecL][2] = (int)GPIORead(botao[2]);
      if (matriz[countL][0] == 1)
        printf("Botão 'A' pressionado!\n");
      if (matriz[countL][1] == 1)
        printf("Botão 'B' pressionado!\n");
      if (matriz[countL][2] == 1)
        printf("Botão 'C' pressionado!\n");
    } else if (selecL == 1) {
      matriz[selecL][0] = (int)GPIORead(botao[0]);
      matriz[selecL][1] = (int)GPIORead(botao[1]);
      matriz[selecL][2] = (int)GPIORead(botao[2]);
      if (matriz[countL][0] == 1)
        printf("Botão 'D' pressionado!\n");
      if (matriz[countL][1] == 1)
        printf("Botão 'E' pressionado!\n");
      if (matriz[countL][2] == 1)
        printf("Botão 'F' pressionado!\n");
    } else if (selecL == 2) {
      matriz[selecL][0] = (int)GPIORead(botao[0]);
      matriz[selecL][1] = (int)GPIORead(botao[1]);
      matriz[selecL][2] = (int)GPIORead(botao[2]);
      if (matriz[countL][0] == 1)
        printf("Botão 'G' pressionado!\n");
      if (matriz[countL][1] == 1)
        printf("Botão 'H' pressionado!\n");
      if (matriz[countL][2] == 1)
        printf("Botão 'I' pressionado!\n");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe6a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xe68(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1050 <memset@plt>
movl   $0x0,-0x44(%rbp)
lea    0xe4b(%rip),%rdi
call   1040 <printf@plt>
lea    0xe67(%rip),%rdi
lea    -0x44(%rbp),%rsi
call   1090 <scanf@plt>
cmpl   $0x1,-0x44(%rbp)
jne    11e5 <main+0x65>
jmp    1255 <main+0xd5>
mov    $0x5,%edi
call   10a0 <GPIOUnexport@plt>
cmp    $0x1,%eax
jne    123d <main+0xbd>
mov    $0x6,%edi
call   10a0 <GPIOUnexport@plt>
cmp    $0x1,%eax
jne    123d <main+0xbd>
mov    $0xd,%edi
call   10a0 <GPIOUnexport@plt>
cmp    $0x1,%eax
jne    123d <main+0xbd>
lea    0xe12(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
movl   $0x0,-0x4(%rbp)
jmp    1567 <main+0x3e7>
lea    0xe15(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1567 <main+0x3e7>
movl   $0x0,-0x48(%rbp)
cmpl   $0x3,-0x48(%rbp)
jge    1293 <main+0x113>
movslq -0x48(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%edi
call   1080 <GPIOExport@plt>
movslq -0x48(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%edi
mov    $0x1,%esi
call   1030 <GPIODirection@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    125c <main+0xdc>
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
lea    0xdef(%rip),%rdi
call   1040 <printf@plt>
lea    0xd79(%rip),%rdi
lea    -0x54(%rbp),%rsi
call   1090 <scanf@plt>
xor    %eax,%eax
cmpl   $0x0,-0x54(%rbp)
mov    %al,-0x55(%rbp)
jl     12dd <main+0x15d>
cmpl   $0x3,-0x54(%rbp)
setl   %al
mov    %al,-0x55(%rbp)
mov    -0x55(%rbp),%al
test   $0x1,%al
jne    12b4 <main+0x134>
cmpl   $0x0,-0x54(%rbp)
jne    13b8 <main+0x238>
mov    -0x10(%rbp),%edi
call   1070 <GPIORead@plt>
mov    %eax,%ecx
movslq -0x54(%rbp),%rdx
lea    -0x40(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edi
call   1070 <GPIORead@plt>
mov    %eax,%ecx
movslq -0x54(%rbp),%rdx
lea    -0x40(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%edi
call   1070 <GPIORead@plt>
mov    %eax,%ecx
movslq -0x54(%rbp),%rdx
lea    -0x40(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x8(%rax)
movslq -0x4c(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x1,(%rax)
jne    1369 <main+0x1e9>
lea    0xd63(%rip),%rdi
call   1040 <printf@plt>
movslq -0x4c(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x1,0x4(%rax)
jne    138e <main+0x20e>
lea    0xd57(%rip),%rdi
call   1040 <printf@plt>
movslq -0x4c(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x1,0x8(%rax)
jne    13b3 <main+0x233>
lea    0xd4b(%rip),%rdi
call   1040 <printf@plt>
jmp    1562 <main+0x3e2>
cmpl   $0x1,-0x54(%rbp)
jne    1488 <main+0x308>
mov    -0x10(%rbp),%edi
call   1070 <GPIORead@plt>
mov    %eax,%ecx
movslq -0x54(%rbp),%rdx
lea    -0x40(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edi
call   1070 <GPIORead@plt>
mov    %eax,%ecx
movslq -0x54(%rbp),%rdx
lea    -0x40(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%edi
call   1070 <GPIORead@plt>
mov    %eax,%ecx
movslq -0x54(%rbp),%rdx
lea    -0x40(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x8(%rax)
movslq -0x4c(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x1,(%rax)
jne    1439 <main+0x2b9>
lea    0xcde(%rip),%rdi
call   1040 <printf@plt>
movslq -0x4c(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x1,0x4(%rax)
jne    145e <main+0x2de>
lea    0xcd2(%rip),%rdi
call   1040 <printf@plt>
movslq -0x4c(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x1,0x8(%rax)
jne    1483 <main+0x303>
lea    0xcc6(%rip),%rdi
call   1040 <printf@plt>
jmp    155d <main+0x3dd>
cmpl   $0x2,-0x54(%rbp)
jne    1558 <main+0x3d8>
mov    -0x10(%rbp),%edi
call   1070 <GPIORead@plt>
mov    %eax,%ecx
movslq -0x54(%rbp),%rdx
lea    -0x40(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edi
call   1070 <GPIORead@plt>
mov    %eax,%ecx
movslq -0x54(%rbp),%rdx
lea    -0x40(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%edi
call   1070 <GPIORead@plt>
mov    %eax,%ecx
movslq -0x54(%rbp),%rdx
lea    -0x40(%rbp),%rax
imul   $0xc,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x8(%rax)
movslq -0x4c(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x1,(%rax)
jne    1509 <main+0x389>
lea    0xc59(%rip),%rdi
call   1040 <printf@plt>
movslq -0x4c(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x1,0x4(%rax)
jne    152e <main+0x3ae>
lea    0xc4d(%rip),%rdi
call   1040 <printf@plt>
movslq -0x4c(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
cmpl   $0x1,0x8(%rax)
jne    1553 <main+0x3d3>
lea    0xc41(%rip),%rdi
call   1040 <printf@plt>
jmp    1558 <main+0x3d8>
jmp    155d <main+0x3dd>
jmp    1562 <main+0x3e2>
jmp    12a1 <main+0x121>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xe78(%rip),%rdi
call   1050 <printf@plt>
lea    0xe94(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1080 <scanf@plt>
cmpl   $0x1,0xc(%rsp)
jne    1234 <main+0xc4>
mov    $0x5,%edi
call   1070 <GPIOExport@plt>
mov    $0x5,%edi
mov    $0x1,%esi
call   1040 <GPIODirection@plt>
mov    $0x6,%edi
call   1070 <GPIOExport@plt>
mov    $0x6,%edi
mov    $0x1,%esi
call   1040 <GPIODirection@plt>
mov    $0xd,%edi
call   1070 <GPIOExport@plt>
mov    $0xd,%edi
mov    $0x1,%esi
call   1040 <GPIODirection@plt>
lea    0xe95(%rip),%r14
lea    0xe26(%rip),%r15
lea    0x8(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
movl   $0x0,0x8(%rsp)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
cmpl   $0x3,0x8(%rsp)
jb     1220 <main+0xb0>
jmp    1210 <main+0xa0>
mov    $0x5,%edi
call   1090 <GPIOUnexport@plt>
cmp    $0x1,%eax
jne    1276 <main+0x106>
mov    $0x6,%edi
call   1090 <GPIOUnexport@plt>
cmp    $0x1,%eax
jne    1276 <main+0x106>
mov    $0xd,%edi
call   1090 <GPIOUnexport@plt>
cmp    $0x1,%eax
jne    1276 <main+0x106>
lea    0xe07(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
jmp    1282 <main+0x112>
lea    0xdae(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.botao = [3 x i32] [i32 5, i32 6, i32 13]
@.str = [40 x i8] c"\0ADeseja Iniciar o Programa ? S[1]/N[2]\09\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"Programa Encerrado com Sucesso! \0A\00"
@.str.3 = [69 x i8] c"\0A\09Houve Erros ao encerrar o programa!\0A\09Verifique os Terminais GPIO!\0A\00"
@.str.4 = [41 x i8] c"Digite a Linha para Verificar o Bot\C3\A3o!\0A\00"
@.str.5 = [25 x i8] c"Bot\C3\A3o 'A' pressionado!\0A\00"
@.str.6 = [25 x i8] c"Bot\C3\A3o 'B' pressionado!\0A\00"
@.str.7 = [25 x i8] c"Bot\C3\A3o 'C' pressionado!\0A\00"
@.str.8 = [25 x i8] c"Bot\C3\A3o 'D' pressionado!\0A\00"
@.str.9 = [25 x i8] c"Bot\C3\A3o 'E' pressionado!\0A\00"
@.str.10 = [25 x i8] c"Bot\C3\A3o 'F' pressionado!\0A\00"
@.str.11 = [25 x i8] c"Bot\C3\A3o 'G' pressionado!\0A\00"
@.str.12 = [25 x i8] c"Bot\C3\A3o 'H' pressionado!\0A\00"
@.str.13 = [25 x i8] c"Bot\C3\A3o 'I' pressionado!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca [3 x [3 x i32]]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [3 x i32]* %2 to i8*
%10 = bitcast [3 x [3 x i32]]* %3 to i8*
store i32 0, i32* %4
br label %11
11: ; preds = %37, %0
%12 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %17
16: ; preds = %11
br label %39
17: ; preds = %11
%18 = call i32 @GPIOUnexport(i32 5)
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %29
20: ; preds = %17
%21 = call i32 @GPIOUnexport(i32 6)
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = call i32 @GPIOUnexport(i32 13)
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 (...) @getchar()
store i32 0, i32* %1
br label %238
29: ; preds = %23, %20, %17
%30 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %238
31: ; No predecessors!
%32 = load i32, i32* %4
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* %4
%36 = icmp slt i32 %35, 3
br label %37
37: ; preds = %34, %31
%38 = phi i1 [ false, %31 ], [ %36, %34 ]
br i1 %38, label %11, label %39
39: ; preds = %37, %16
store i32 0, i32* %5
br label %40
40: ; preds = %54, %39
%41 = load i32, i32* %5
%42 = icmp slt i32 %41, 3
br i1 %42, label %43, label %57
43: ; preds = %40
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = call i32 @GPIOExport(i32 %47)
%49 = load i32, i32* %5
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = call i32 @GPIODirection(i32 %52, i32 1)
br label %54
54: ; preds = %43
%55 = load i32, i32* %5
%56 = add nsw i32 %55, 1
store i32 %56, i32* %5
br label %40
57: ; preds = %40
store i32 0, i32* %6
store i32 0, i32* %7
br label %58
58: ; preds = %57, %237
store i32 0, i32* %8
%59 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
br label %60
60: ; preds = %68, %58
%61 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
br label %62
62: ; preds = %60
%63 = load i32, i32* %8
%64 = icmp sge i32 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = load i32, i32* %8
%67 = icmp slt i32 %66, 3
br label %68
68: ; preds = %65, %62
%69 = phi i1 [ false, %62 ], [ %67, %65 ]
br i1 %69, label %60, label %70
70: ; preds = %68
%71 = load i32, i32* %8
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %125
73: ; preds = %70
%74 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%75 = load i32, i32* %74
%76 = call i64 @GPIORead(i32 %75)
%77 = trunc i64 %76 to i32
%78 = load i32, i32* %8
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %79
%81 = getelementptr inbounds [3 x i32], [3 x i32]* %80, i64 0, i64 0
store i32 %77, i32* %81
%82 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%83 = load i32, i32* %82
%84 = call i64 @GPIORead(i32 %83)
%85 = trunc i64 %84 to i32
%86 = load i32, i32* %8
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %87
%89 = getelementptr inbounds [3 x i32], [3 x i32]* %88, i64 0, i64 1
store i32 %85, i32* %89
%90 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%91 = load i32, i32* %90
%92 = call i64 @GPIORead(i32 %91)
%93 = trunc i64 %92 to i32
%94 = load i32, i32* %8
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %95
%97 = getelementptr inbounds [3 x i32], [3 x i32]* %96, i64 0, i64 2
store i32 %93, i32* %97
%98 = load i32, i32* %6
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %99
%101 = getelementptr inbounds [3 x i32], [3 x i32]* %100, i64 0, i64 0
%102 = load i32, i32* %101
%103 = icmp eq i32 %102, 1
br i1 %103, label %104, label %106
104: ; preds = %73
%105 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %106
106: ; preds = %104, %73
%107 = load i32, i32* %6
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %108
%110 = getelementptr inbounds [3 x i32], [3 x i32]* %109, i64 0, i64 1
%111 = load i32, i32* %110
%112 = icmp eq i32 %111, 1
br i1 %112, label %113, label %115
113: ; preds = %106
%114 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
br label %115
115: ; preds = %113, %106
%116 = load i32, i32* %6
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %117
%119 = getelementptr inbounds [3 x i32], [3 x i32]* %118, i64 0, i64 2
%120 = load i32, i32* %119
%121 = icmp eq i32 %120, 1
br i1 %121, label %122, label %124
122: ; preds = %115
%123 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br label %124
124: ; preds = %122, %115
br label %237
125: ; preds = %70
%126 = load i32, i32* %8
%127 = icmp eq i32 %126, 1
br i1 %127, label %128, label %180
128: ; preds = %125
%129 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%130 = load i32, i32* %129
%131 = call i64 @GPIORead(i32 %130)
%132 = trunc i64 %131 to i32
%133 = load i32, i32* %8
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %134
%136 = getelementptr inbounds [3 x i32], [3 x i32]* %135, i64 0, i64 0
store i32 %132, i32* %136
%137 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%138 = load i32, i32* %137
%139 = call i64 @GPIORead(i32 %138)
%140 = trunc i64 %139 to i32
%141 = load i32, i32* %8
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %142
%144 = getelementptr inbounds [3 x i32], [3 x i32]* %143, i64 0, i64 1
store i32 %140, i32* %144
%145 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%146 = load i32, i32* %145
%147 = call i64 @GPIORead(i32 %146)
%148 = trunc i64 %147 to i32
%149 = load i32, i32* %8
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %150
%152 = getelementptr inbounds [3 x i32], [3 x i32]* %151, i64 0, i64 2
store i32 %148, i32* %152
%153 = load i32, i32* %6
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %154
%156 = getelementptr inbounds [3 x i32], [3 x i32]* %155, i64 0, i64 0
%157 = load i32, i32* %156
%158 = icmp eq i32 %157, 1
br i1 %158, label %159, label %161
159: ; preds = %128
%160 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
br label %161
161: ; preds = %159, %128
%162 = load i32, i32* %6
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %163
%165 = getelementptr inbounds [3 x i32], [3 x i32]* %164, i64 0, i64 1
%166 = load i32, i32* %165
%167 = icmp eq i32 %166, 1
br i1 %167, label %168, label %170
168: ; preds = %161
%169 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
br label %170
170: ; preds = %168, %161
%171 = load i32, i32* %6
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %172
%174 = getelementptr inbounds [3 x i32], [3 x i32]* %173, i64 0, i64 2
%175 = load i32, i32* %174
%176 = icmp eq i32 %175, 1
br i1 %176, label %177, label %179
177: ; preds = %170
%178 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
br label %179
179: ; preds = %177, %170
br label %236
180: ; preds = %125
%181 = load i32, i32* %8
%182 = icmp eq i32 %181, 2
br i1 %182, label %183, label %235
183: ; preds = %180
%184 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%185 = load i32, i32* %184
%186 = call i64 @GPIORead(i32 %185)
%187 = trunc i64 %186 to i32
%188 = load i32, i32* %8
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %189
%191 = getelementptr inbounds [3 x i32], [3 x i32]* %190, i64 0, i64 0
store i32 %187, i32* %191
%192 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%193 = load i32, i32* %192
%194 = call i64 @GPIORead(i32 %193)
%195 = trunc i64 %194 to i32
%196 = load i32, i32* %8
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %197
%199 = getelementptr inbounds [3 x i32], [3 x i32]* %198, i64 0, i64 1
store i32 %195, i32* %199
%200 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%201 = load i32, i32* %200
%202 = call i64 @GPIORead(i32 %201)
%203 = trunc i64 %202 to i32
%204 = load i32, i32* %8
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %205
%207 = getelementptr inbounds [3 x i32], [3 x i32]* %206, i64 0, i64 2
store i32 %203, i32* %207
%208 = load i32, i32* %6
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %209
%211 = getelementptr inbounds [3 x i32], [3 x i32]* %210, i64 0, i64 0
%212 = load i32, i32* %211
%213 = icmp eq i32 %212, 1
br i1 %213, label %214, label %216
214: ; preds = %183
%215 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
br label %216
216: ; preds = %214, %183
%217 = load i32, i32* %6
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %218
%220 = getelementptr inbounds [3 x i32], [3 x i32]* %219, i64 0, i64 1
%221 = load i32, i32* %220
%222 = icmp eq i32 %221, 1
br i1 %222, label %223, label %225
223: ; preds = %216
%224 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0))
br label %225
225: ; preds = %223, %216
%226 = load i32, i32* %6
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %3, i64 0, i64 %227
%229 = getelementptr inbounds [3 x i32], [3 x i32]* %228, i64 0, i64 2
%230 = load i32, i32* %229
%231 = icmp eq i32 %230, 1
br i1 %231, label %232, label %234
232: ; preds = %225
%233 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0))
br label %234
234: ; preds = %232, %225
br label %235
235: ; preds = %234, %180
br label %236
236: ; preds = %235, %179
br label %237
237: ; preds = %236, %124
br label %58
238: ; preds = %29, %26
%239 = load i32, i32* %1
ret i32 %239
}

LLVM IR (-O2):
@.str = [40 x i8] c"\0ADeseja Iniciar o Programa ? S[1]/N[2]\09\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [68 x i8] c"\0A\09Houve Erros ao encerrar o programa!\0A\09Verifique os Terminais GPIO!\00"
@str.14 = [33 x i8] c"Programa Encerrado com Sucesso! \00"
@str.15 = [40 x i8] c"Digite a Linha para Verificar o Bot\C3\A3o!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %16
8: ; preds = %0
%9 = call i32 @GPIOExport(i32 5)
%10 = call i32 @GPIODirection(i32 5, i32 1)
%11 = call i32 @GPIOExport(i32 6)
%12 = call i32 @GPIODirection(i32 6, i32 1)
%13 = call i32 @GPIOExport(i32 13)
%14 = call i32 @GPIODirection(i32 13, i32 1)
%15 = bitcast i32* %2 to i8*
br label %30
16: ; preds = %0
%17 = call i32 @GPIOUnexport(i32 5)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = call i32 @GPIOUnexport(i32 6)
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = call i32 @GPIOUnexport(i32 13)
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.14, i64 0, i64 0))
%27 = call i32 (...) @getchar()
br label %37
28: ; preds = %22, %19, %16
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
br label %37
30: ; preds = %8, %36
store i32 0, i32* %2
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.15, i64 0, i64 0))
br label %32
32: ; preds = %32, %30
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%34 = load i32, i32* %2
%35 = icmp ult i32 %34, 3
br i1 %35, label %32, label %36
36: ; preds = %32
br label %30
37: ; preds = %28, %25
ret i32 0
}