#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*/ delay_ms(int);
int /*<<< orphan*/ exibeNumero(int);
scalar_t__ resetIsPressed();
int /*<<< orphan*/ setup();
int /*<<< orphan*/ setupLCD();
scalar_t__ stopIsPressed();
int main() {
  int contador = 0;
  int stop = 0;
  setup();
  setupLCD();
  while (1 == 1) {
    exibeNumero(contador);
    if (stop == 0)
      contador++;
    if (contador > 9999)
      contador = 0;
    if (resetIsPressed()) {
      contador = 0;
    }
    if (stopIsPressed()) {
      if (stop == 0)
        stop = 1;
      else
        stop = 0;
    }
    if (stop == 0)
      delay_ms(1000);
    else
      delay_ms(100);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1080 <setup@plt>
mov    $0x0,%al
call   1050 <setupLCD@plt>
mov    -0x8(%rbp),%edi
call   1040 <exibeNumero@plt>
cmpl   $0x0,-0xc(%rbp)
jne    11a6 <main+0x46>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x270f,-0x8(%rbp)
jle    11ba <main+0x5a>
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1070 <resetIsPressed@plt>
cmp    $0x0,%rax
je     11d2 <main+0x72>
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <stopIsPressed@plt>
cmp    $0x0,%rax
je     1205 <main+0xa5>
cmpl   $0x0,-0xc(%rbp)
jne    11f9 <main+0x99>
movl   $0x1,-0xc(%rbp)
jmp    1200 <main+0xa0>
movl   $0x0,-0xc(%rbp)
jmp    1205 <main+0xa5>
cmpl   $0x0,-0xc(%rbp)
jne    121e <main+0xbe>
mov    $0x3e8,%edi
call   1060 <delay_ms@plt>
jmp    1228 <main+0xc8>
mov    $0x64,%edi
call   1060 <delay_ms@plt>
jmp    118b <main+0x2b>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <setup@plt>
xor    %eax,%eax
call   1050 <setupLCD@plt>
xor    %r14d,%r14d
jmp    1185 <main+0x25>
nopl   0x0(%rax)
call   1060 <delay_ms@plt>
mov    %ebx,%edi
call   1040 <exibeNumero@plt>
xor    %ebp,%ebp
test   %r14d,%r14d
sete   %bpl
add    %ebp,%ebx
mov    $0x0,%r15d
cmp    $0x2710,%ebx
jge    11a8 <main+0x48>
mov    %ebx,%r15d
xor    %eax,%eax
call   1070 <resetIsPressed@plt>
mov    %r15d,%ebx
test   %rax,%rax
je     11b9 <main+0x59>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <stopIsPressed@plt>
test   %rax,%rax
je     11c8 <main+0x68>
mov    %ebp,%r14d
mov    $0x3e8,%edi
test   %r14d,%r14d
je     1180 <main+0x20>
mov    $0x64,%edi
jmp    1180 <main+0x20>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%4 = call i32 (...) @setup()
%5 = call i32 (...) @setupLCD()
br label %6
6: ; preds = %0, %38
%7 = load i32, i32* %2
%8 = call i32 @exibeNumero(i32 %7)
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %14
14: ; preds = %11, %6
%15 = load i32, i32* %2
%16 = icmp sgt i32 %15, 9999
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 0, i32* %2
br label %18
18: ; preds = %17, %14
%19 = call i64 (...) @resetIsPressed()
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 0, i32* %2
br label %22
22: ; preds = %21, %18
%23 = call i64 (...) @stopIsPressed()
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load i32, i32* %3
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %25
store i32 1, i32* %3
br label %30
29: ; preds = %25
store i32 0, i32* %3
br label %30
30: ; preds = %29, %28
br label %31
31: ; preds = %30, %22
%32 = load i32, i32* %3
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @delay_ms(i32 1000)
br label %38
36: ; preds = %31
%37 = call i32 @delay_ms(i32 100)
br label %38
38: ; preds = %36, %34
br label %6
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @setup()
%2 = tail call i32 (...) @setupLCD()
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ 0, %0 ], [ %14, %3 ]
%5 = phi i32 [ 0, %0 ], [ %17, %3 ]
%6 = tail call i32 @exibeNumero(i32 %4)
%7 = icmp eq i32 %5, 0
%8 = zext i1 %7 to i32
%9 = add nsw i32 %4, %8
%10 = icmp sgt i32 %9, 9999
%11 = select i1 %10, i32 0, i32 %9
%12 = tail call i64 (...) @resetIsPressed()
%13 = icmp eq i64 %12, 0
%14 = select i1 %13, i32 %11, i32 0
%15 = tail call i64 (...) @stopIsPressed()
%16 = icmp eq i64 %15, 0
%17 = select i1 %16, i32 %5, i32 %8
%18 = icmp eq i32 %17, 0
%19 = select i1 %18, i32 1000, i32 100
%20 = tail call i32 @delay_ms(i32 %19)
br label %3
}