#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 */
long _display_off(unsigned char);
scalar_t__ _gpio_detect(int);
scalar_t__ _gpio_in(int);
int /*<<< orphan*/ _gpioevent(int, int /*<<< orphan*/, unsigned char);
int /*<<< orphan*/ _gpiomode(int, int);
int /*<<< orphan*/ _gpiopull(int, int);
int /*<<< orphan*/ _gpiotoggle(int, int);
int /*<<< orphan*/ _sleep(int);
int /*<<< orphan*/ print32_debug(long, int, int);
long int _user_start() {
  _gpiomode(18, 0b000);
  _gpiomode(19, 0b000);
  _gpiomode(20, 0b000);
  _gpiopull(20, 2);
  _gpioevent(18, 0, ((unsigned char)1));
  _gpioevent(19, 0, ((unsigned char)1));
  _gpioevent(20, 0, ((unsigned char)1));
  while (((unsigned char)1)) {
    long int value;
    if (_gpio_in(20))
      _gpiotoggle(21, 2);
    if (_gpio_detect(18)) {
      value = _display_off(((unsigned char)0));
      print32_debug(value, 100, 100);
    }
    if (_gpio_detect(19)) {
      value = _display_off(((unsigned char)1));
      print32_debug(value, 100, 112);
    }
    _sleep(1000);
  }
  return 0;
}


x86 assembly (clang, -O0):
<_user_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x12,%edi
xor    %esi,%esi
call   10b0 <_gpiomode@plt>
mov    $0x13,%edi
xor    %esi,%esi
call   10b0 <_gpiomode@plt>
mov    $0x14,%edi
xor    %esi,%esi
call   10b0 <_gpiomode@plt>
mov    $0x14,%edi
mov    $0x2,%esi
call   1090 <_gpiopull@plt>
mov    $0x12,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <_gpioevent@plt>
mov    $0x13,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <_gpioevent@plt>
mov    $0x14,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <_gpioevent@plt>
mov    $0x14,%edi
call   1080 <_gpio_in@plt>
cmp    $0x0,%rax
je     1221 <_user_start+0x91>
mov    $0x15,%edi
mov    $0x2,%esi
call   1040 <_gpiotoggle@plt>
mov    $0x12,%edi
call   1070 <_gpio_detect@plt>
cmp    $0x0,%rax
je     1250 <_user_start+0xc0>
xor    %edi,%edi
call   10a0 <_display_off@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x64,%edx
mov    %edx,%esi
call   1060 <print32_debug@plt>
mov    $0x13,%edi
call   1070 <_gpio_detect@plt>
cmp    $0x0,%rax
je     1285 <_user_start+0xf5>
mov    $0x1,%edi
call   10a0 <_display_off@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x64,%esi
mov    $0x70,%edx
call   1060 <print32_debug@plt>
mov    $0x3e8,%edi
call   1030 <_sleep@plt>
jmp    11fe <_user_start+0x6e>

x86 assembly (clang, -O2):
<_user_start>:
push   %rax
mov    $0x12,%edi
xor    %esi,%esi
call   10b0 <_gpiomode@plt>
mov    $0x13,%edi
xor    %esi,%esi
call   10b0 <_gpiomode@plt>
mov    $0x14,%edi
xor    %esi,%esi
call   10b0 <_gpiomode@plt>
mov    $0x14,%edi
mov    $0x2,%esi
call   1090 <_gpiopull@plt>
mov    $0x12,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <_gpioevent@plt>
mov    $0x13,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <_gpioevent@plt>
mov    $0x14,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <_gpioevent@plt>
jmp    120a <_user_start+0x7a>
nopl   0x0(%rax)
mov    $0x3e8,%edi
call   1030 <_sleep@plt>
mov    $0x14,%edi
call   1080 <_gpio_in@plt>
test   %rax,%rax
je     1228 <_user_start+0x98>
mov    $0x15,%edi
mov    $0x2,%esi
call   1040 <_gpiotoggle@plt>
mov    $0x12,%edi
call   1070 <_gpio_detect@plt>
test   %rax,%rax
je     1250 <_user_start+0xc0>
xor    %edi,%edi
call   10a0 <_display_off@plt>
mov    %rax,%rdi
mov    $0x64,%esi
mov    $0x64,%edx
call   1060 <print32_debug@plt>
mov    $0x13,%edi
call   1070 <_gpio_detect@plt>
test   %rax,%rax
je     1200 <_user_start+0x70>
mov    $0x1,%edi
call   10a0 <_display_off@plt>
mov    %rax,%rdi
mov    $0x64,%esi
mov    $0x70,%edx
call   1060 <print32_debug@plt>
jmp    1200 <_user_start+0x70>

LLVM IR (-O0):
define i64 @_user_start() {
%1 = alloca i64
%2 = call i32 @_gpiomode(i32 18, i32 0)
%3 = call i32 @_gpiomode(i32 19, i32 0)
%4 = call i32 @_gpiomode(i32 20, i32 0)
%5 = call i32 @_gpiopull(i32 20, i32 2)
%6 = call i32 @_gpioevent(i32 18, i32 0, i8 zeroext 1)
%7 = call i32 @_gpioevent(i32 19, i32 0, i8 zeroext 1)
%8 = call i32 @_gpioevent(i32 20, i32 0, i8 zeroext 1)
br label %9
9: ; preds = %0, %28
%10 = call i64 @_gpio_in(i32 20)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 @_gpiotoggle(i32 21, i32 2)
br label %14
14: ; preds = %12, %9
%15 = call i64 @_gpio_detect(i32 18)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = call i64 @_display_off(i8 zeroext 0)
store i64 %18, i64* %1
%19 = load i64, i64* %1
%20 = call i32 @print32_debug(i64 %19, i32 100, i32 100)
br label %21
21: ; preds = %17, %14
%22 = call i64 @_gpio_detect(i32 19)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = call i64 @_display_off(i8 zeroext 1)
store i64 %25, i64* %1
%26 = load i64, i64* %1
%27 = call i32 @print32_debug(i64 %26, i32 100, i32 112)
br label %28
28: ; preds = %24, %21
%29 = call i32 @_sleep(i32 1000)
br label %9
}

LLVM IR (-O2):
define i64 @_user_start() {
%1 = tail call i32 @_gpiomode(i32 18, i32 0)
%2 = tail call i32 @_gpiomode(i32 19, i32 0)
%3 = tail call i32 @_gpiomode(i32 20, i32 0)
%4 = tail call i32 @_gpiopull(i32 20, i32 2)
%5 = tail call i32 @_gpioevent(i32 18, i32 0, i8 zeroext 1)
%6 = tail call i32 @_gpioevent(i32 19, i32 0, i8 zeroext 1)
%7 = tail call i32 @_gpioevent(i32 20, i32 0, i8 zeroext 1)
br label %8
8: ; preds = %0, %25
%9 = tail call i64 @_gpio_in(i32 20)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 @_gpiotoggle(i32 21, i32 2)
br label %13
13: ; preds = %11, %8
%14 = tail call i64 @_gpio_detect(i32 18)
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = tail call i64 @_display_off(i8 zeroext 0)
%18 = tail call i32 @print32_debug(i64 %17, i32 100, i32 100)
br label %19
19: ; preds = %16, %13
%20 = tail call i64 @_gpio_detect(i32 19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = tail call i64 @_display_off(i8 zeroext 1)
%24 = tail call i32 @print32_debug(i64 %23, i32 100, i32 112)
br label %25
25: ; preds = %22, %19
%26 = tail call i32 @_sleep(i32 1000)
br label %8
}