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


x86 assembly (clang, -O0):
<prog_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xe5,%edi
xor    %esi,%esi
call   1040 <gpio_set@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jge    1155 <prog_end+0x25>
jmp    11a1 <prog_end+0x71>
mov    $0xea,%edi
xor    %esi,%esi
call   1040 <gpio_set@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jge    1172 <prog_end+0x42>
jmp    11a1 <prog_end+0x71>
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    119c <prog_end+0x6c>
jmp    11a1 <prog_end+0x71>
jmp    11a1 <prog_end+0x71>
mov    $0xe5,%edi
call   1030 <gpio_close@plt>
mov    $0xea,%edi
call   1030 <gpio_close@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prog_end>:
push   %rbx
mov    $0xe5,%edi
xor    %esi,%esi
call   1040 <gpio_set@plt>
test   %eax,%eax
js     116a <prog_end+0x3a>
mov    $0xea,%edi
xor    %esi,%esi
call   1040 <gpio_set@plt>
test   %eax,%eax
js     116a <prog_end+0x3a>
mov    $0x1,%edi
call   1050 <usleep@plt>
mov    $0xea,%edi
mov    $0x1,%esi
call   1040 <gpio_set@plt>
mov    %eax,%ebx
mov    $0xe5,%edi
call   1030 <gpio_close@plt>
mov    $0xea,%edi
call   1030 <gpio_close@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @prog_end() {
%1 = alloca i32
%2 = call i32 @gpio_set(i32 229, i32 0)
store i32 %2, i32* %1
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
br label %15
5: ; preds = %0
%6 = call i32 @gpio_set(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 %15
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 %15
14: ; preds = %9
br label %15
15: ; preds = %14, %13, %8, %4
%16 = call i32 @gpio_close(i32 229)
%17 = call i32 @gpio_close(i32 234)
%18 = load i32, i32* %1
ret i32 %18
}

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