#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 */
scalar_t__ a_button_clicked();
int /*<<< orphan*/ ao();
scalar_t__ b_button_clicked();
int /*<<< orphan*/ c_button_clicked();
int /*<<< orphan*/ create_connect();
int /*<<< orphan*/ create_disconnect();
int /*<<< orphan*/ create_drive(int, int /*<<< orphan*/);
int /*<<< orphan*/ create_drive_straight(int);
int /*<<< orphan*/ create_stop();
int /*<<< orphan*/ disable_servo(int);
int /*<<< orphan*/ enable_servo(int);
int /*<<< orphan*/ extra_buttons_show();
int /*<<< orphan*/ motor(int, int);
int /*<<< orphan*/ msleep(int);
int /*<<< orphan*/ printf(char *, ...);
double seconds();
int /*<<< orphan*/ set_a_button_text(char *);
int /*<<< orphan*/ set_b_button_text(char *);
int /*<<< orphan*/ set_c_button_text(char *);
int /*<<< orphan*/ set_servo_position(int, int);
int /*<<< orphan*/ set_x_button_text(char *);
int /*<<< orphan*/ set_y_button_text(char *);
int /*<<< orphan*/ set_z_button_text(char *);
scalar_t__ x_button_clicked();
scalar_t__ y_button_clicked();
scalar_t__ z_button_clicked();
int main() {
  int m1 = 0, m2 = 3, pageno = 0;
  double createDriveTime;
  printf("Start!\n");
  extra_buttons_show();
  while (1) {
    while (pageno == 0) {
      set_a_button_text("Forward");
      set_b_button_text("Backward");
      set_c_button_text("All Off");
      set_x_button_text("OpenHand");
      set_y_button_text("CloseHand");
      set_z_button_text("Create Page");
      if (a_button_clicked()) {
        printf("Moving forward...\n");
        motor(m1, 100);
        motor(m2, 100);
        while (!c_button_clicked()) {
          msleep(1);
        }
        ao();
      }
      if (b_button_clicked()) {
        printf("Moving backward...\n");
        motor(m1, -100);
        motor(m2, -100);
        while (!c_button_clicked()) {
          msleep(1);
        }
        ao();
      }
      if (x_button_clicked()) {
        enable_servo(3);
        set_servo_position(3, 0);
        msleep(300);
        disable_servo(3);
      }
      if (y_button_clicked()) {
        enable_servo(3);
        set_servo_position(3, 1300);
        msleep(300);
        disable_servo(3);
      }
      if (z_button_clicked()) {
        pageno = 1;
        create_connect();
      }
    }
    while (pageno == 1) {
      set_a_button_text("Create Fwd");
      set_b_button_text("Create Bwd");
      set_c_button_text("Stop");
      set_x_button_text("Turn R");
      set_y_button_text("Turn L");
      set_z_button_text("M S Page");
      if (a_button_clicked()) {
        createDriveTime = 0;
        printf("Create Moving forward w/ spd 100...\n");
        create_drive_straight(100);
        createDriveTime = seconds();
        while (!c_button_clicked()) {
          msleep(1);
        }
        create_stop();
        printf("Time: %f seconds\n", seconds() - createDriveTime);
      }
      if (b_button_clicked()) {
        createDriveTime = 0;
        printf("Create Moving backward w/ spd 100...\n");
        create_drive_straight(-100);
        createDriveTime = seconds();
        while (!c_button_clicked()) {
          msleep(1);
        }
        create_stop();
        printf("Time: %f seconds\n", seconds() - createDriveTime);
      }
      if (x_button_clicked()) {
        create_drive(-50, 0);
        while (!c_button_clicked()) {
          msleep(1);
        }
        create_stop();
      }
      if (y_button_clicked()) {
        create_drive(50, 0);
        while (!c_button_clicked()) {
          msleep(1);
        }
        create_stop();
      }
      if (z_button_clicked()) {
        pageno = 0;
        create_disconnect();
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x0,%al
call   1180 <extra_buttons_show@plt>
jmp    12de <main+0x3e>
cmpl   $0x0,-0x10(%rbp)
jne    14a3 <main+0x203>
lea    0xd19(%rip),%rdi
call   1170 <set_a_button_text@plt>
lea    0xd15(%rip),%rdi
call   1040 <set_b_button_text@plt>
lea    0xd12(%rip),%rdi
call   1190 <set_c_button_text@plt>
lea    0xd0e(%rip),%rdi
call   1160 <set_x_button_text@plt>
lea    0xd0b(%rip),%rdi
call   10f0 <set_y_button_text@plt>
lea    0xd09(%rip),%rdi
call   10c0 <set_z_button_text@plt>
mov    $0x0,%al
call   11c0 <a_button_clicked@plt>
cmp    $0x0,%rax
je     139b <main+0xfb>
lea    0xcf8(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x8(%rbp),%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    -0xc(%rbp),%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x0,%al
call   1140 <c_button_clicked@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1385 <main+0xe5>
jmp    1394 <main+0xf4>
mov    $0x1,%edi
call   1090 <msleep@plt>
jmp    1369 <main+0xc9>
mov    $0x0,%al
call   10e0 <ao@plt>
mov    $0x0,%al
call   10b0 <b_button_clicked@plt>
cmp    $0x0,%rax
je     1406 <main+0x166>
lea    0xca0(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x8(%rbp),%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    -0xc(%rbp),%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x0,%al
call   1140 <c_button_clicked@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13f0 <main+0x150>
jmp    13ff <main+0x15f>
mov    $0x1,%edi
call   1090 <msleep@plt>
jmp    13d4 <main+0x134>
mov    $0x0,%al
call   10e0 <ao@plt>
mov    $0x0,%al
call   1150 <x_button_clicked@plt>
cmp    $0x0,%rax
je     1441 <main+0x1a1>
mov    $0x3,%edi
call   1110 <enable_servo@plt>
mov    $0x3,%edi
xor    %esi,%esi
call   11a0 <set_servo_position@plt>
mov    $0x12c,%edi
call   1090 <msleep@plt>
mov    $0x3,%edi
call   1130 <disable_servo@plt>
mov    $0x0,%al
call   1100 <y_button_clicked@plt>
cmp    $0x0,%rax
je     147f <main+0x1df>
mov    $0x3,%edi
call   1110 <enable_servo@plt>
mov    $0x3,%edi
mov    $0x514,%esi
call   11a0 <set_servo_position@plt>
mov    $0x12c,%edi
call   1090 <msleep@plt>
mov    $0x3,%edi
call   1130 <disable_servo@plt>
mov    $0x0,%al
call   1120 <z_button_clicked@plt>
cmp    $0x0,%rax
je     149e <main+0x1fe>
movl   $0x1,-0x10(%rbp)
mov    $0x0,%al
call   1050 <create_connect@plt>
jmp    12de <main+0x3e>
jmp    14a8 <main+0x208>
cmpl   $0x1,-0x10(%rbp)
jne    16ce <main+0x42e>
lea    0xbae(%rip),%rdi
call   1170 <set_a_button_text@plt>
lea    0xbad(%rip),%rdi
call   1040 <set_b_button_text@plt>
lea    0xbac(%rip),%rdi
call   1190 <set_c_button_text@plt>
lea    0xba5(%rip),%rdi
call   1160 <set_x_button_text@plt>
lea    0xba0(%rip),%rdi
call   10f0 <set_y_button_text@plt>
lea    0xb9b(%rip),%rdi
call   10c0 <set_z_button_text@plt>
mov    $0x0,%al
call   11c0 <a_button_clicked@plt>
cmp    $0x0,%rax
je     1583 <main+0x2e3>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xb7f(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x64,%edi
call   10d0 <create_drive_straight@plt>
mov    $0x0,%al
call   1080 <seconds@plt>
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1140 <c_button_clicked@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1553 <main+0x2b3>
jmp    1562 <main+0x2c2>
mov    $0x1,%edi
call   1090 <msleep@plt>
jmp    1537 <main+0x297>
mov    $0x0,%al
call   1060 <create_stop@plt>
mov    $0x0,%al
call   1080 <seconds@plt>
subsd  -0x18(%rbp),%xmm0
lea    0xb42(%rip),%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
mov    $0x0,%al
call   10b0 <b_button_clicked@plt>
cmp    $0x0,%rax
je     160c <main+0x36c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xb2d(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0xffffff9c,%edi
call   10d0 <create_drive_straight@plt>
mov    $0x0,%al
call   1080 <seconds@plt>
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1140 <c_button_clicked@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    15dc <main+0x33c>
jmp    15eb <main+0x34b>
mov    $0x1,%edi
call   1090 <msleep@plt>
jmp    15c0 <main+0x320>
mov    $0x0,%al
call   1060 <create_stop@plt>
mov    $0x0,%al
call   1080 <seconds@plt>
subsd  -0x18(%rbp),%xmm0
lea    0xab9(%rip),%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
mov    $0x0,%al
call   1150 <x_button_clicked@plt>
cmp    $0x0,%rax
je     165b <main+0x3bb>
mov    $0xffffffce,%edi
xor    %esi,%esi
call   1070 <create_drive@plt>
mov    $0x0,%al
call   1140 <c_button_clicked@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1645 <main+0x3a5>
jmp    1654 <main+0x3b4>
mov    $0x1,%edi
call   1090 <msleep@plt>
jmp    1629 <main+0x389>
mov    $0x0,%al
call   1060 <create_stop@plt>
mov    $0x0,%al
call   1100 <y_button_clicked@plt>
cmp    $0x0,%rax
je     16aa <main+0x40a>
mov    $0x32,%edi
xor    %esi,%esi
call   1070 <create_drive@plt>
mov    $0x0,%al
call   1140 <c_button_clicked@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1694 <main+0x3f4>
jmp    16a3 <main+0x403>
mov    $0x1,%edi
call   1090 <msleep@plt>
jmp    1678 <main+0x3d8>
mov    $0x0,%al
call   1060 <create_stop@plt>
mov    $0x0,%al
call   1120 <z_button_clicked@plt>
cmp    $0x0,%rax
je     16c9 <main+0x429>
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   11b0 <create_disconnect@plt>
jmp    14a8 <main+0x208>
jmp    12d9 <main+0x39>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xdba(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1190 <extra_buttons_show@plt>
lea    0xd6e(%rip),%r15
lea    0xd72(%rip),%r12
lea    0xd70(%rip),%r13
lea    0xd70(%rip),%rbx
lea    0xd70(%rip),%rbp
lea    0xd72(%rip),%r14
jmp    1307 <main+0x57>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   11c0 <create_disconnect@plt>
lea    0xcf2(%rip),%rdi
call   1180 <set_a_button_text@plt>
lea    0xcee(%rip),%rdi
call   1040 <set_b_button_text@plt>
lea    0xceb(%rip),%rdi
call   11a0 <set_c_button_text@plt>
lea    0xce7(%rip),%rdi
call   1170 <set_x_button_text@plt>
lea    0xce4(%rip),%rdi
call   1100 <set_y_button_text@plt>
lea    0xce2(%rip),%rdi
call   10d0 <set_z_button_text@plt>
xor    %eax,%eax
call   11d0 <a_button_clicked@plt>
test   %rax,%rax
je     13b7 <main+0x107>
lea    0xd7d(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x3,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1150 <c_button_clicked@plt>
test   %eax,%eax
jne    13b0 <main+0x100>
mov    $0x1,%edi
call   10a0 <msleep@plt>
jmp    1390 <main+0xe0>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10f0 <ao@plt>
xor    %eax,%eax
call   10c0 <b_button_clicked@plt>
test   %rax,%rax
je     1417 <main+0x167>
lea    0xd02(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x3,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1150 <c_button_clicked@plt>
test   %eax,%eax
jne    1410 <main+0x160>
mov    $0x1,%edi
call   10a0 <msleep@plt>
jmp    13f0 <main+0x140>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10f0 <ao@plt>
xor    %eax,%eax
call   1160 <x_button_clicked@plt>
test   %rax,%rax
je     144d <main+0x19d>
mov    $0x3,%edi
call   1120 <enable_servo@plt>
mov    $0x3,%edi
xor    %esi,%esi
call   11b0 <set_servo_position@plt>
mov    $0x12c,%edi
call   10a0 <msleep@plt>
mov    $0x3,%edi
call   1140 <disable_servo@plt>
xor    %eax,%eax
call   1110 <y_button_clicked@plt>
test   %rax,%rax
je     1486 <main+0x1d6>
mov    $0x3,%edi
call   1120 <enable_servo@plt>
mov    $0x3,%edi
mov    $0x514,%esi
call   11b0 <set_servo_position@plt>
mov    $0x12c,%edi
call   10a0 <msleep@plt>
mov    $0x3,%edi
call   1140 <disable_servo@plt>
xor    %eax,%eax
call   1130 <z_button_clicked@plt>
test   %rax,%rax
je     1307 <main+0x57>
xor    %eax,%eax
call   1060 <create_connect@plt>
jmp    14b7 <main+0x207>
nop
xor    %eax,%eax
call   1070 <create_stop@plt>
xor    %eax,%eax
call   1130 <z_button_clicked@plt>
test   %rax,%rax
jne    1300 <main+0x50>
lea    0xb7a(%rip),%rdi
call   1180 <set_a_button_text@plt>
mov    %r15,%rdi
call   1040 <set_b_button_text@plt>
mov    %r12,%rdi
call   11a0 <set_c_button_text@plt>
mov    %r13,%rdi
call   1170 <set_x_button_text@plt>
mov    %rbx,%rdi
call   1100 <set_y_button_text@plt>
mov    %rbp,%rdi
call   10d0 <set_z_button_text@plt>
xor    %eax,%eax
call   11d0 <a_button_clicked@plt>
test   %rax,%rax
je     155d <main+0x2ad>
lea    0xbaa(%rip),%rdi
call   1050 <puts@plt>
mov    $0x64,%edi
call   10e0 <create_drive_straight@plt>
xor    %eax,%eax
call   1090 <seconds@plt>
movsd  %xmm0,(%rsp)
nopl   0x0(%rax)
xor    %eax,%eax
call   1150 <c_button_clicked@plt>
test   %eax,%eax
jne    1540 <main+0x290>
mov    $0x1,%edi
call   10a0 <msleep@plt>
jmp    1520 <main+0x270>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <create_stop@plt>
xor    %eax,%eax
call   1090 <seconds@plt>
subsd  (%rsp),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   10b0 <printf@plt>
xor    %eax,%eax
call   10c0 <b_button_clicked@plt>
test   %rax,%rax
je     15cd <main+0x31d>
lea    0xb13(%rip),%rdi
call   1050 <puts@plt>
mov    $0xffffff9c,%edi
call   10e0 <create_drive_straight@plt>
xor    %eax,%eax
call   1090 <seconds@plt>
movsd  %xmm0,(%rsp)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1150 <c_button_clicked@plt>
test   %eax,%eax
jne    15b0 <main+0x300>
mov    $0x1,%edi
call   10a0 <msleep@plt>
jmp    1590 <main+0x2e0>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <create_stop@plt>
xor    %eax,%eax
call   1090 <seconds@plt>
subsd  (%rsp),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   10b0 <printf@plt>
xor    %eax,%eax
call   1160 <x_button_clicked@plt>
test   %rax,%rax
je     1617 <main+0x367>
mov    $0xffffffce,%edi
xor    %esi,%esi
call   1080 <create_drive@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1150 <c_button_clicked@plt>
test   %eax,%eax
jne    1610 <main+0x360>
mov    $0x1,%edi
call   10a0 <msleep@plt>
jmp    15f0 <main+0x340>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <create_stop@plt>
xor    %eax,%eax
call   1110 <y_button_clicked@plt>
test   %rax,%rax
je     14a7 <main+0x1f7>
mov    $0x32,%edi
xor    %esi,%esi
call   1080 <create_drive@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1150 <c_button_clicked@plt>
test   %eax,%eax
jne    14a0 <main+0x1f0>
mov    $0x1,%edi
call   10a0 <msleep@plt>
jmp    1640 <main+0x390>

LLVM IR (-O0):
@.str = [8 x i8] c"Start!\0A\00"
@.str.1 = [8 x i8] c"Forward\00"
@.str.2 = [9 x i8] c"Backward\00"
@.str.3 = [8 x i8] c"All Off\00"
@.str.4 = [9 x i8] c"OpenHand\00"
@.str.5 = [10 x i8] c"CloseHand\00"
@.str.6 = [12 x i8] c"Create Page\00"
@.str.7 = [19 x i8] c"Moving forward...\0A\00"
@.str.8 = [20 x i8] c"Moving backward...\0A\00"
@.str.9 = [11 x i8] c"Create Fwd\00"
@.str.10 = [11 x i8] c"Create Bwd\00"
@.str.11 = [5 x i8] c"Stop\00"
@.str.12 = [7 x i8] c"Turn R\00"
@.str.13 = [7 x i8] c"Turn L\00"
@.str.14 = [9 x i8] c"M S Page\00"
@.str.15 = [37 x i8] c"Create Moving forward w/ spd 100...\0A\00"
@.str.16 = [18 x i8] c"Time: %f seconds\0A\00"
@.str.17 = [38 x i8] c"Create Moving backward w/ spd 100...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 0, i32* %1
store i32 0, i32* %2
store i32 3, i32* %3
store i32 0, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @extra_buttons_show()
br label %8
8: ; preds = %0, %154
br label %9
9: ; preds = %73, %8
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %74
12: ; preds = %9
%13 = call i32 @set_a_button_text(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @set_b_button_text(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @set_c_button_text(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @set_x_button_text(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @set_y_button_text(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 @set_z_button_text(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%19 = call i64 (...) @a_button_clicked()
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %35
21: ; preds = %12
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%23 = load i32, i32* %2
%24 = call i32 @motor(i32 %23, i32 100)
%25 = load i32, i32* %3
%26 = call i32 @motor(i32 %25, i32 100)
br label %27
27: ; preds = %31, %21
%28 = call i32 (...) @c_button_clicked()
%29 = icmp ne i32 %28, 0
%30 = xor i1 %29, true
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @msleep(i32 1)
br label %27
33: ; preds = %27
%34 = call i32 (...) @ao()
br label %35
35: ; preds = %33, %12
%36 = call i64 (...) @b_button_clicked()
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %52
38: ; preds = %35
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
%40 = load i32, i32* %2
%41 = call i32 @motor(i32 %40, i32 -100)
%42 = load i32, i32* %3
%43 = call i32 @motor(i32 %42, i32 -100)
br label %44
44: ; preds = %48, %38
%45 = call i32 (...) @c_button_clicked()
%46 = icmp ne i32 %45, 0
%47 = xor i1 %46, true
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 @msleep(i32 1)
br label %44
50: ; preds = %44
%51 = call i32 (...) @ao()
br label %52
52: ; preds = %50, %35
%53 = call i64 (...) @x_button_clicked()
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %60
55: ; preds = %52
%56 = call i32 @enable_servo(i32 3)
%57 = call i32 @set_servo_position(i32 3, i32 0)
%58 = call i32 @msleep(i32 300)
%59 = call i32 @disable_servo(i32 3)
br label %60
60: ; preds = %55, %52
%61 = call i64 (...) @y_button_clicked()
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %68
63: ; preds = %60
%64 = call i32 @enable_servo(i32 3)
%65 = call i32 @set_servo_position(i32 3, i32 1300)
%66 = call i32 @msleep(i32 300)
%67 = call i32 @disable_servo(i32 3)
br label %68
68: ; preds = %63, %60
%69 = call i64 (...) @z_button_clicked()
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %68
store i32 1, i32* %4
%72 = call i32 (...) @create_connect()
br label %73
73: ; preds = %71, %68
br label %9
74: ; preds = %9
br label %75
75: ; preds = %153, %74
%76 = load i32, i32* %4
%77 = icmp eq i32 %76, 1
br i1 %77, label %78, label %154
78: ; preds = %75
%79 = call i32 @set_a_button_text(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%80 = call i32 @set_b_button_text(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%81 = call i32 @set_c_button_text(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%82 = call i32 @set_x_button_text(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%83 = call i32 @set_y_button_text(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%84 = call i32 @set_z_button_text(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0))
%85 = call i64 (...) @a_button_clicked()
%86 = icmp ne i64 %85, 0
br i1 %86, label %87, label %103
87: ; preds = %78
store double 0.000000e+00, double* %5
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.15, i64 0, i64 0))
%89 = call i32 @create_drive_straight(i32 100)
%90 = call double (...) @seconds()
store double %90, double* %5
br label %91
91: ; preds = %95, %87
%92 = call i32 (...) @c_button_clicked()
%93 = icmp ne i32 %92, 0
%94 = xor i1 %93, true
br i1 %94, label %95, label %97
95: ; preds = %91
%96 = call i32 @msleep(i32 1)
br label %91
97: ; preds = %91
%98 = call i32 (...) @create_stop()
%99 = call double (...) @seconds()
%100 = load double, double* %5
%101 = fsub double %99, %100
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0), double %101)
br label %103
103: ; preds = %97, %78
%104 = call i64 (...) @b_button_clicked()
%105 = icmp ne i64 %104, 0
br i1 %105, label %106, label %122
106: ; preds = %103
store double 0.000000e+00, double* %5
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.17, i64 0, i64 0))
%108 = call i32 @create_drive_straight(i32 -100)
%109 = call double (...) @seconds()
store double %109, double* %5
br label %110
110: ; preds = %114, %106
%111 = call i32 (...) @c_button_clicked()
%112 = icmp ne i32 %111, 0
%113 = xor i1 %112, true
br i1 %113, label %114, label %116
114: ; preds = %110
%115 = call i32 @msleep(i32 1)
br label %110
116: ; preds = %110
%117 = call i32 (...) @create_stop()
%118 = call double (...) @seconds()
%119 = load double, double* %5
%120 = fsub double %118, %119
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0), double %120)
br label %122
122: ; preds = %116, %103
%123 = call i64 (...) @x_button_clicked()
%124 = icmp ne i64 %123, 0
br i1 %124, label %125, label %135
125: ; preds = %122
%126 = call i32 @create_drive(i32 -50, i32 0)
br label %127
127: ; preds = %131, %125
%128 = call i32 (...) @c_button_clicked()
%129 = icmp ne i32 %128, 0
%130 = xor i1 %129, true
br i1 %130, label %131, label %133
131: ; preds = %127
%132 = call i32 @msleep(i32 1)
br label %127
133: ; preds = %127
%134 = call i32 (...) @create_stop()
br label %135
135: ; preds = %133, %122
%136 = call i64 (...) @y_button_clicked()
%137 = icmp ne i64 %136, 0
br i1 %137, label %138, label %148
138: ; preds = %135
%139 = call i32 @create_drive(i32 50, i32 0)
br label %140
140: ; preds = %144, %138
%141 = call i32 (...) @c_button_clicked()
%142 = icmp ne i32 %141, 0
%143 = xor i1 %142, true
br i1 %143, label %144, label %146
144: ; preds = %140
%145 = call i32 @msleep(i32 1)
br label %140
146: ; preds = %140
%147 = call i32 (...) @create_stop()
br label %148
148: ; preds = %146, %135
%149 = call i64 (...) @z_button_clicked()
%150 = icmp ne i64 %149, 0
br i1 %150, label %151, label %153
151: ; preds = %148
store i32 0, i32* %4
%152 = call i32 (...) @create_disconnect()
br label %153
153: ; preds = %151, %148
br label %75
154: ; preds = %75
br label %8
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"Forward\00"
@.str.2 = [9 x i8] c"Backward\00"
@.str.3 = [8 x i8] c"All Off\00"
@.str.4 = [9 x i8] c"OpenHand\00"
@.str.5 = [10 x i8] c"CloseHand\00"
@.str.6 = [12 x i8] c"Create Page\00"
@.str.9 = [11 x i8] c"Create Fwd\00"
@.str.10 = [11 x i8] c"Create Bwd\00"
@.str.11 = [5 x i8] c"Stop\00"
@.str.12 = [7 x i8] c"Turn R\00"
@.str.13 = [7 x i8] c"Turn L\00"
@.str.14 = [9 x i8] c"M S Page\00"
@.str.16 = [18 x i8] c"Time: %f seconds\0A\00"
@str = [7 x i8] c"Start!\00"
@str.18 = [37 x i8] c"Create Moving backward w/ spd 100...\00"
@str.19 = [36 x i8] c"Create Moving forward w/ spd 100...\00"
@str.20 = [19 x i8] c"Moving backward...\00"
@str.21 = [18 x i8] c"Moving forward...\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @extra_buttons_show()
br label %5
3: ; preds = %131
%4 = tail call i32 (...) @create_disconnect()
br label %60
5: ; preds = %60, %0
%6 = tail call i32 @set_a_button_text(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @set_b_button_text(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @set_c_button_text(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 @set_x_button_text(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 @set_y_button_text(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%11 = tail call i32 @set_z_button_text(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%12 = tail call i64 (...) @a_button_clicked()
%13 = icmp eq i64 %12, 0
br i1 %13, label %26, label %14
14: ; preds = %5
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.21, i64 0, i64 0))
%16 = tail call i32 @motor(i32 0, i32 100)
%17 = tail call i32 @motor(i32 3, i32 100)
%18 = tail call i32 (...) @c_button_clicked()
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %14, %20
%21 = tail call i32 @msleep(i32 1)
%22 = tail call i32 (...) @c_button_clicked()
%23 = icmp eq i32 %22, 0
br i1 %23, label %20, label %24
24: ; preds = %20, %14
%25 = tail call i32 (...) @ao()
br label %26
26: ; preds = %24, %5
%27 = tail call i64 (...) @b_button_clicked()
%28 = icmp eq i64 %27, 0
br i1 %28, label %41, label %29
29: ; preds = %26
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.20, i64 0, i64 0))
%31 = tail call i32 @motor(i32 0, i32 -100)
%32 = tail call i32 @motor(i32 3, i32 -100)
%33 = tail call i32 (...) @c_button_clicked()
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %29, %35
%36 = tail call i32 @msleep(i32 1)
%37 = tail call i32 (...) @c_button_clicked()
%38 = icmp eq i32 %37, 0
br i1 %38, label %35, label %39
39: ; preds = %35, %29
%40 = tail call i32 (...) @ao()
br label %41
41: ; preds = %39, %26
%42 = tail call i64 (...) @x_button_clicked()
%43 = icmp eq i64 %42, 0
br i1 %43, label %49, label %44
44: ; preds = %41
%45 = tail call i32 @enable_servo(i32 3)
%46 = tail call i32 @set_servo_position(i32 3, i32 0)
%47 = tail call i32 @msleep(i32 300)
%48 = tail call i32 @disable_servo(i32 3)
br label %49
49: ; preds = %44, %41
%50 = tail call i64 (...) @y_button_clicked()
%51 = icmp eq i64 %50, 0
br i1 %51, label %57, label %52
52: ; preds = %49
%53 = tail call i32 @enable_servo(i32 3)
%54 = tail call i32 @set_servo_position(i32 3, i32 1300)
%55 = tail call i32 @msleep(i32 300)
%56 = tail call i32 @disable_servo(i32 3)
br label %57
57: ; preds = %52, %49
%58 = tail call i64 (...) @z_button_clicked()
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %57, %3
br label %5
61: ; preds = %57
%62 = tail call i32 (...) @create_connect()
br label %63
63: ; preds = %131, %61
%64 = tail call i32 @set_a_button_text(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%65 = tail call i32 @set_b_button_text(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%66 = tail call i32 @set_c_button_text(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%67 = tail call i32 @set_x_button_text(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%68 = tail call i32 @set_y_button_text(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0))
%69 = tail call i32 @set_z_button_text(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0))
%70 = tail call i64 (...) @a_button_clicked()
%71 = icmp eq i64 %70, 0
br i1 %71, label %87, label %72
72: ; preds = %63
%73 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.19, i64 0, i64 0))
%74 = tail call i32 @create_drive_straight(i32 100)
%75 = tail call double (...) @seconds()
%76 = tail call i32 (...) @c_button_clicked()
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %82
78: ; preds = %72, %78
%79 = tail call i32 @msleep(i32 1)
%80 = tail call i32 (...) @c_button_clicked()
%81 = icmp eq i32 %80, 0
br i1 %81, label %78, label %82
82: ; preds = %78, %72
%83 = tail call i32 (...) @create_stop()
%84 = tail call double (...) @seconds()
%85 = fsub double %84, %75
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0), double %85)
br label %87
87: ; preds = %82, %63
%88 = tail call i64 (...) @b_button_clicked()
%89 = icmp eq i64 %88, 0
br i1 %89, label %105, label %90
90: ; preds = %87
%91 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.18, i64 0, i64 0))
%92 = tail call i32 @create_drive_straight(i32 -100)
%93 = tail call double (...) @seconds()
%94 = tail call i32 (...) @c_button_clicked()
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %100
96: ; preds = %90, %96
%97 = tail call i32 @msleep(i32 1)
%98 = tail call i32 (...) @c_button_clicked()
%99 = icmp eq i32 %98, 0
br i1 %99, label %96, label %100
100: ; preds = %96, %90
%101 = tail call i32 (...) @create_stop()
%102 = tail call double (...) @seconds()
%103 = fsub double %102, %93
%104 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.16, i64 0, i64 0), double %103)
br label %105
105: ; preds = %100, %87
%106 = tail call i64 (...) @x_button_clicked()
%107 = icmp eq i64 %106, 0
br i1 %107, label %118, label %108
108: ; preds = %105
%109 = tail call i32 @create_drive(i32 -50, i32 0)
%110 = tail call i32 (...) @c_button_clicked()
%111 = icmp eq i32 %110, 0
br i1 %111, label %112, label %116
112: ; preds = %108, %112
%113 = tail call i32 @msleep(i32 1)
%114 = tail call i32 (...) @c_button_clicked()
%115 = icmp eq i32 %114, 0
br i1 %115, label %112, label %116
116: ; preds = %112, %108
%117 = tail call i32 (...) @create_stop()
br label %118
118: ; preds = %116, %105
%119 = tail call i64 (...) @y_button_clicked()
%120 = icmp eq i64 %119, 0
br i1 %120, label %131, label %121
121: ; preds = %118
%122 = tail call i32 @create_drive(i32 50, i32 0)
%123 = tail call i32 (...) @c_button_clicked()
%124 = icmp eq i32 %123, 0
br i1 %124, label %125, label %129
125: ; preds = %121, %125
%126 = tail call i32 @msleep(i32 1)
%127 = tail call i32 (...) @c_button_clicked()
%128 = icmp eq i32 %127, 0
br i1 %128, label %125, label %129
129: ; preds = %125, %121
%130 = tail call i32 (...) @create_stop()
br label %131
131: ; preds = %129, %118
%132 = tail call i64 (...) @z_button_clicked()
%133 = icmp eq i64 %132, 0
br i1 %133, label %63, label %3
}