#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 gpio_open(int, int);
int gpio_set(int, int);
int /*<<< orphan*/ usleep(int);
int prog_begin() {
  int ret;
  if ((ret = gpio_open(229, 1)) < 0)
    goto out;
  if ((ret = gpio_open(234, 0)) < 0)
    goto out;
  usleep(1);
  if ((ret = gpio_set(234, 1)) < 0)
    goto out;
  usleep(1500);
out:
  return ret;
}


x86 assembly (clang, -O0):
<prog_begin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xe5,%edi
mov    $0x1,%esi
call   1030 <gpio_open@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jge    1158 <prog_begin+0x28>
jmp    11a9 <prog_begin+0x79>
mov    $0xea,%edi
xor    %esi,%esi
call   1030 <gpio_open@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jge    1175 <prog_begin+0x45>
jmp    11a9 <prog_begin+0x79>
mov    $0x1,%edi
call   1050 <usleep@plt>
mov    $0xea,%edi
mov    $0x1,%esi
call   1040 <gpio_set@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jge    119f <prog_begin+0x6f>
jmp    11a9 <prog_begin+0x79>
mov    $0x5dc,%edi
call   1050 <usleep@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prog_begin>:
push   %rbx
mov    $0xe5,%edi
mov    $0x1,%esi
call   1030 <gpio_open@plt>
test   %eax,%eax
js     117f <prog_begin+0x4f>
mov    $0xea,%edi
xor    %esi,%esi
call   1030 <gpio_open@plt>
test   %eax,%eax
js     117f <prog_begin+0x4f>
mov    $0x1,%edi
call   1050 <usleep@plt>
mov    $0xea,%edi
mov    $0x1,%esi
call   1040 <gpio_set@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1181 <prog_begin+0x51>
mov    $0x5dc,%edi
call   1050 <usleep@plt>
jmp    1181 <prog_begin+0x51>
mov    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @prog_begin() {
%1 = alloca i32
%2 = call i32 @gpio_open(i32 229, i32 1)
store i32 %2, i32* %1
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
br label %16
5: ; preds = %0
%6 = call i32 @gpio_open(i32 234, i32 0)
store i32 %6, i32* %1
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %5
br label %16
9: ; preds = %5
%10 = call i32 @usleep(i32 1)
%11 = call i32 @gpio_set(i32 234, i32 1)
store i32 %11, i32* %1
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
br label %16
14: ; preds = %9
%15 = call i32 @usleep(i32 1500)
br label %16
16: ; preds = %14, %13, %8, %4
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
define i32 @prog_begin() {
%1 = tail call i32 @gpio_open(i32 229, i32 1)
%2 = icmp slt i32 %1, 0
br i1 %2, label %12, label %3
3: ; preds = %0
%4 = tail call i32 @gpio_open(i32 234, i32 0)
%5 = icmp slt i32 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %3
%7 = tail call i32 @usleep(i32 1)
%8 = tail call i32 @gpio_set(i32 234, i32 1)
%9 = icmp slt i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 @usleep(i32 1500)
br label %12
12: ; preds = %6, %3, %0, %10
%13 = phi i32 [ %1, %0 ], [ %4, %3 ], [ %8, %6 ], [ %8, %10 ]
ret i32 %13
}