#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int fd;
};
struct epoll_event {
  int events;
  TYPE_1__ data;
};

/* Variables and functions */
int EPOLLET;
int EPOLLIN;
int EPOLLPRI;
int /*<<< orphan*/ EPOLL_CTL_ADD;
int /*<<< orphan*/ EPOLL_CTL_DEL;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ close(int);
int epoll_create(int);
int epoll_ctl(int, int /*<<< orphan*/, int, struct epoll_event *);
int epoll_wait(int, struct epoll_event *, int, int);
scalar_t__ gpio_event_added(unsigned int);
int /*<<< orphan*/ gpio_export(unsigned int);
int /*<<< orphan*/ gpio_set_direction(unsigned int, int);
int /*<<< orphan*/ gpio_set_edge(unsigned int, unsigned int);
int /*<<< orphan*/ gpio_unexport(unsigned int);
int /*<<< orphan*/ lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int open_value_file(unsigned int);
int read(int, char *, int);
int blocking_wait_for_edge(unsigned int gpio, unsigned int edge) {
  int epfd, fd, n, i;
  struct epoll_event events, ev;
  char buf;
  if (gpio_event_added(gpio))
    return 1;
  if ((epfd = epoll_create(1)) == -1)
    return 2;
  gpio_export(gpio);
  gpio_set_direction(gpio, 1);
  gpio_set_edge(gpio, edge);
  if ((fd = open_value_file(gpio)) == -1)
    return 3;
  ev.events = EPOLLIN | EPOLLET | EPOLLPRI;
  ev.data.fd = fd;
  if (epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &ev) == -1) {
    close(fd);
    gpio_unexport(gpio);
    return 4;
  }
  for (i = 0; i < 2; i++)
    if ((n = epoll_wait(epfd, &events, 1, -1)) == -1) {
      epoll_ctl(epfd, EPOLL_CTL_DEL, fd, &ev);
      close(fd);
      gpio_unexport(gpio);
      return 5;
    }
  if (n > 0) {
    lseek(events.data.fd, 0, SEEK_SET);
    if (read(events.data.fd, &buf, 1) != 1) {
      epoll_ctl(epfd, EPOLL_CTL_DEL, fd, &ev);
      close(fd);
      gpio_unexport(gpio);
      close(epfd);
      return 6;
    }
    if (events.data.fd != fd) {
      epoll_ctl(epfd, EPOLL_CTL_DEL, fd, &ev);
      close(fd);
      gpio_unexport(gpio);
      return 7;
    }
  }
  epoll_ctl(epfd, EPOLL_CTL_DEL, fd, &ev);
  close(fd);
  gpio_unexport(gpio);
  return 0;
}


x86 assembly (clang, -O0):
<blocking_wait_for_edge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <gpio_event_added@plt>
cmp    $0x0,%rax
je     11ec <blocking_wait_for_edge+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1410 <blocking_wait_for_edge+0x250>
mov    $0x1,%edi
call   10d0 <epoll_create@plt>
mov    %eax,-0x10(%rbp)
cmp    $0xffffffff,%eax
jne    120e <blocking_wait_for_edge+0x4e>
movl   $0x2,-0x4(%rbp)
jmp    1410 <blocking_wait_for_edge+0x250>
mov    -0x8(%rbp),%edi
call   1050 <gpio_export@plt>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   10e0 <gpio_set_direction@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1070 <gpio_set_edge@plt>
mov    -0x8(%rbp),%edi
call   10a0 <open_value_file@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    124e <blocking_wait_for_edge+0x8e>
movl   $0x3,-0x4(%rbp)
jmp    1410 <blocking_wait_for_edge+0x250>
mov    0x2d83(%rip),%rax
mov    (%rax),%eax
mov    0x2d5a(%rip),%rcx
or     (%rcx),%eax
mov    0x2d81(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%edi
mov    0x2d54(%rip),%rax
mov    (%rax),%esi
mov    -0x14(%rbp),%edx
lea    -0x30(%rbp),%rcx
call   1080 <epoll_ctl@plt>
cmp    $0xffffffff,%eax
jne    12af <blocking_wait_for_edge+0xef>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    -0x8(%rbp),%edi
call   10b0 <gpio_unexport@plt>
movl   $0x4,-0x4(%rbp)
jmp    1410 <blocking_wait_for_edge+0x250>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1329 <blocking_wait_for_edge+0x169>
mov    -0x10(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
call   10c0 <epoll_wait@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
jne    1316 <blocking_wait_for_edge+0x156>
mov    -0x10(%rbp),%edi
mov    0x2d0c(%rip),%rax
mov    (%rax),%esi
mov    -0x14(%rbp),%edx
lea    -0x30(%rbp),%rcx
call   1080 <epoll_ctl@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    -0x8(%rbp),%edi
call   10b0 <gpio_unexport@plt>
movl   $0x5,-0x4(%rbp)
jmp    1410 <blocking_wait_for_edge+0x250>
jmp    131b <blocking_wait_for_edge+0x15b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12b6 <blocking_wait_for_edge+0xf6>
cmpl   $0x0,-0x18(%rbp)
jle    13e1 <blocking_wait_for_edge+0x221>
mov    -0x24(%rbp),%edi
mov    0x2c83(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
mov    -0x24(%rbp),%edi
lea    -0x31(%rbp),%rsi
mov    $0x1,%edx
call   1090 <read@plt>
cmp    $0x1,%eax
je     139c <blocking_wait_for_edge+0x1dc>
mov    -0x10(%rbp),%edi
mov    0x2c8e(%rip),%rax
mov    (%rax),%esi
mov    -0x14(%rbp),%edx
lea    -0x30(%rbp),%rcx
call   1080 <epoll_ctl@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    -0x8(%rbp),%edi
call   10b0 <gpio_unexport@plt>
mov    -0x10(%rbp),%edi
call   1060 <close@plt>
movl   $0x6,-0x4(%rbp)
jmp    1410 <blocking_wait_for_edge+0x250>
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     13dc <blocking_wait_for_edge+0x21c>
mov    -0x10(%rbp),%edi
mov    0x2c46(%rip),%rax
mov    (%rax),%esi
mov    -0x14(%rbp),%edx
lea    -0x30(%rbp),%rcx
call   1080 <epoll_ctl@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    -0x8(%rbp),%edi
call   10b0 <gpio_unexport@plt>
movl   $0x7,-0x4(%rbp)
jmp    1410 <blocking_wait_for_edge+0x250>
jmp    13e1 <blocking_wait_for_edge+0x221>
mov    -0x10(%rbp),%edi
mov    0x2c0d(%rip),%rax
mov    (%rax),%esi
mov    -0x14(%rbp),%edx
lea    -0x30(%rbp),%rcx
call   1080 <epoll_ctl@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    -0x8(%rbp),%edi
call   10b0 <gpio_unexport@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blocking_wait_for_edge>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %edi,%ebx
call   1030 <gpio_event_added@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     11eb <blocking_wait_for_edge+0x2b>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   10d0 <epoll_create@plt>
cmp    $0xffffffff,%eax
je     1324 <blocking_wait_for_edge+0x164>
mov    %eax,%r15d
mov    %ebx,%edi
call   1050 <gpio_export@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   10e0 <gpio_set_direction@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1070 <gpio_set_edge@plt>
mov    %ebx,%edi
call   10a0 <open_value_file@plt>
cmp    $0xffffffff,%eax
je     132e <blocking_wait_for_edge+0x16e>
mov    %eax,%r14d
mov    0x2da1(%rip),%rax
mov    0x2d7a(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2d9f(%rip),%rax
or     (%rax),%ecx
mov    %ecx,0x8(%rsp)
mov    %r14d,0xc(%rsp)
mov    0x2d75(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rcx
mov    %r15d,%edi
mov    %r14d,%edx
call   1080 <epoll_ctl@plt>
cmp    $0xffffffff,%eax
je     136a <blocking_wait_for_edge+0x1aa>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
call   10c0 <epoll_wait@plt>
cmp    $0xffffffff,%eax
je     1338 <blocking_wait_for_edge+0x178>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0x1,%edx
mov    $0xffffffff,%ecx
call   10c0 <epoll_wait@plt>
cmp    $0xffffffff,%eax
je     1338 <blocking_wait_for_edge+0x178>
test   %eax,%eax
jle    12f5 <blocking_wait_for_edge+0x135>
mov    0x14(%rsp),%edi
mov    0x2cfb(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
mov    0x14(%rsp),%edi
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1090 <read@plt>
cmp    $0x1,%eax
jne    1383 <blocking_wait_for_edge+0x1c3>
cmp    %r14d,0x14(%rsp)
jne    13bd <blocking_wait_for_edge+0x1fd>
mov    0x2cfc(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rcx
mov    %r15d,%edi
mov    %r14d,%edx
call   1080 <epoll_ctl@plt>
mov    %r14d,%edi
call   1060 <close@plt>
mov    %ebx,%edi
call   10b0 <gpio_unexport@plt>
xor    %eax,%eax
jmp    11e0 <blocking_wait_for_edge+0x20>
mov    $0x2,%eax
jmp    11e0 <blocking_wait_for_edge+0x20>
mov    $0x3,%eax
jmp    11e0 <blocking_wait_for_edge+0x20>
mov    0x2cb9(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rcx
mov    %r15d,%edi
mov    %r14d,%edx
call   1080 <epoll_ctl@plt>
mov    %r14d,%edi
call   1060 <close@plt>
mov    %ebx,%edi
call   10b0 <gpio_unexport@plt>
mov    $0x5,%eax
jmp    11e0 <blocking_wait_for_edge+0x20>
mov    %r14d,%edi
call   1060 <close@plt>
mov    %ebx,%edi
call   10b0 <gpio_unexport@plt>
mov    $0x4,%eax
jmp    11e0 <blocking_wait_for_edge+0x20>
mov    0x2c6e(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rcx
mov    %r15d,%edi
mov    %r14d,%edx
call   1080 <epoll_ctl@plt>
mov    %r14d,%edi
call   1060 <close@plt>
mov    %ebx,%edi
call   10b0 <gpio_unexport@plt>
mov    %r15d,%edi
call   1060 <close@plt>
mov    $0x6,%eax
jmp    11e0 <blocking_wait_for_edge+0x20>
mov    0x2c34(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rcx
mov    %r15d,%edi
mov    %r14d,%edx
call   1080 <epoll_ctl@plt>
mov    %r14d,%edi
call   1060 <close@plt>
mov    %ebx,%edi
call   10b0 <gpio_unexport@plt>
mov    $0x7,%eax
jmp    11e0 <blocking_wait_for_edge+0x20>

LLVM IR (-O0):
%struct.epoll_event = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@EPOLLIN = global i32 0
@EPOLLET = global i32 0
@EPOLLPRI = global i32 0
@EPOLL_CTL_ADD = global i32 0
@EPOLL_CTL_DEL = global i32 0
@SEEK_SET = global i32 0
define i32 @blocking_wait_for_edge(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.epoll_event
%11 = alloca %struct.epoll_event
%12 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
%13 = load i32, i32* %4
%14 = call i64 @gpio_event_added(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 1, i32* %3
br label %124
17: ; preds = %2
%18 = call i32 @epoll_create(i32 1)
store i32 %18, i32* %6
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 2, i32* %3
br label %124
21: ; preds = %17
%22 = load i32, i32* %4
%23 = call i32 @gpio_export(i32 %22)
%24 = load i32, i32* %4
%25 = call i32 @gpio_set_direction(i32 %24, i32 1)
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = call i32 @gpio_set_edge(i32 %26, i32 %27)
%29 = load i32, i32* %4
%30 = call i32 @open_value_file(i32 %29)
store i32 %30, i32* %7
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %33
32: ; preds = %21
store i32 3, i32* %3
br label %124
33: ; preds = %21
%34 = load i32, i32* @EPOLLIN
%35 = load i32, i32* @EPOLLET
%36 = or i32 %34, %35
%37 = load i32, i32* @EPOLLPRI
%38 = or i32 %36, %37
%39 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %11, i32 0, i32 0
store i32 %38, i32* %39
%40 = load i32, i32* %7
%41 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %11, i32 0, i32 1
%42 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %41, i32 0, i32 0
store i32 %40, i32* %42
%43 = load i32, i32* %6
%44 = load i32, i32* @EPOLL_CTL_ADD
%45 = load i32, i32* %7
%46 = call i32 @epoll_ctl(i32 %43, i32 %44, i32 %45, %struct.epoll_event* %11)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %53
48: ; preds = %33
%49 = load i32, i32* %7
%50 = call i32 @close(i32 %49)
%51 = load i32, i32* %4
%52 = call i32 @gpio_unexport(i32 %51)
store i32 4, i32* %3
br label %124
53: ; preds = %33
store i32 0, i32* %9
br label %54
54: ; preds = %71, %53
%55 = load i32, i32* %9
%56 = icmp slt i32 %55, 2
br i1 %56, label %57, label %74
57: ; preds = %54
%58 = load i32, i32* %6
%59 = call i32 @epoll_wait(i32 %58, %struct.epoll_event* %10, i32 1, i32 -1)
store i32 %59, i32* %8
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %70
61: ; preds = %57
%62 = load i32, i32* %6
%63 = load i32, i32* @EPOLL_CTL_DEL
%64 = load i32, i32* %7
%65 = call i32 @epoll_ctl(i32 %62, i32 %63, i32 %64, %struct.epoll_event* %11)
%66 = load i32, i32* %7
%67 = call i32 @close(i32 %66)
%68 = load i32, i32* %4
%69 = call i32 @gpio_unexport(i32 %68)
store i32 5, i32* %3
br label %124
70: ; preds = %57
br label %71
71: ; preds = %70
%72 = load i32, i32* %9
%73 = add nsw i32 %72, 1
store i32 %73, i32* %9
br label %54
74: ; preds = %54
%75 = load i32, i32* %8
%76 = icmp sgt i32 %75, 0
br i1 %76, label %77, label %115
77: ; preds = %74
%78 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %10, i32 0, i32 1
%79 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %78, i32 0, i32 0
%80 = load i32, i32* %79
%81 = load i32, i32* @SEEK_SET
%82 = call i32 @lseek(i32 %80, i32 0, i32 %81)
%83 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %10, i32 0, i32 1
%84 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %83, i32 0, i32 0
%85 = load i32, i32* %84
%86 = call i32 @read(i32 %85, i8* %12, i32 1)
%87 = icmp ne i32 %86, 1
br i1 %87, label %88, label %99
88: ; preds = %77
%89 = load i32, i32* %6
%90 = load i32, i32* @EPOLL_CTL_DEL
%91 = load i32, i32* %7
%92 = call i32 @epoll_ctl(i32 %89, i32 %90, i32 %91, %struct.epoll_event* %11)
%93 = load i32, i32* %7
%94 = call i32 @close(i32 %93)
%95 = load i32, i32* %4
%96 = call i32 @gpio_unexport(i32 %95)
%97 = load i32, i32* %6
%98 = call i32 @close(i32 %97)
store i32 6, i32* %3
br label %124
99: ; preds = %77
%100 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %10, i32 0, i32 1
%101 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %100, i32 0, i32 0
%102 = load i32, i32* %101
%103 = load i32, i32* %7
%104 = icmp ne i32 %102, %103
br i1 %104, label %105, label %114
105: ; preds = %99
%106 = load i32, i32* %6
%107 = load i32, i32* @EPOLL_CTL_DEL
%108 = load i32, i32* %7
%109 = call i32 @epoll_ctl(i32 %106, i32 %107, i32 %108, %struct.epoll_event* %11)
%110 = load i32, i32* %7
%111 = call i32 @close(i32 %110)
%112 = load i32, i32* %4
%113 = call i32 @gpio_unexport(i32 %112)
store i32 7, i32* %3
br label %124
114: ; preds = %99
br label %115
115: ; preds = %114, %74
%116 = load i32, i32* %6
%117 = load i32, i32* @EPOLL_CTL_DEL
%118 = load i32, i32* %7
%119 = call i32 @epoll_ctl(i32 %116, i32 %117, i32 %118, %struct.epoll_event* %11)
%120 = load i32, i32* %7
%121 = call i32 @close(i32 %120)
%122 = load i32, i32* %4
%123 = call i32 @gpio_unexport(i32 %122)
store i32 0, i32* %3
br label %124
124: ; preds = %115, %105, %88, %61, %48, %32, %20, %16
%125 = load i32, i32* %3
ret i32 %125
}

LLVM IR (-O2):
%struct.epoll_event = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@EPOLLIN = global i32 0
@EPOLLET = global i32 0
@EPOLLPRI = global i32 0
@EPOLL_CTL_ADD = global i32 0
@EPOLL_CTL_DEL = global i32 0
@SEEK_SET = global i32 0
define i32 @blocking_wait_for_edge(i32 %0, i32 %1) {
%3 = alloca %struct.epoll_event
%4 = alloca %struct.epoll_event
%5 = alloca i8
%6 = bitcast %struct.epoll_event* %3 to i8*
%7 = bitcast %struct.epoll_event* %4 to i8*
%8 = tail call i64 @gpio_event_added(i32 %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %73
10: ; preds = %2
%11 = tail call i32 @epoll_create(i32 1)
%12 = icmp eq i32 %11, -1
br i1 %12, label %73, label %13
13: ; preds = %10
%14 = tail call i32 @gpio_export(i32 %0)
%15 = tail call i32 @gpio_set_direction(i32 %0, i32 1)
%16 = tail call i32 @gpio_set_edge(i32 %0, i32 %1)
%17 = tail call i32 @open_value_file(i32 %0)
%18 = icmp eq i32 %17, -1
br i1 %18, label %73, label %19
19: ; preds = %13
%20 = load i32, i32* @EPOLLIN
%21 = load i32, i32* @EPOLLET
%22 = or i32 %21, %20
%23 = load i32, i32* @EPOLLPRI
%24 = or i32 %22, %23
%25 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %4, i64 0, i32 0
store i32 %24, i32* %25
%26 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %4, i64 0, i32 1, i32 0
store i32 %17, i32* %26
%27 = load i32, i32* @EPOLL_CTL_ADD
%28 = call i32 @epoll_ctl(i32 %11, i32 %27, i32 %17, %struct.epoll_event* %4)
%29 = icmp eq i32 %28, -1
br i1 %29, label %33, label %30
30: ; preds = %19
%31 = call i32 @epoll_wait(i32 %11, %struct.epoll_event* %3, i32 1, i32 -1)
%32 = icmp eq i32 %31, -1
br i1 %32, label %41, label %36
33: ; preds = %19
%34 = call i32 @close(i32 %17)
%35 = call i32 @gpio_unexport(i32 %0)
br label %73
36: ; preds = %30
%37 = call i32 @epoll_wait(i32 %11, %struct.epoll_event* %3, i32 1, i32 -1)
%38 = icmp eq i32 %37, -1
br i1 %38, label %41, label %39
39: ; preds = %36
%40 = icmp sgt i32 %37, 0
br i1 %40, label %46, label %68
41: ; preds = %36, %30
%42 = load i32, i32* @EPOLL_CTL_DEL
%43 = call i32 @epoll_ctl(i32 %11, i32 %42, i32 %17, %struct.epoll_event* %4)
%44 = call i32 @close(i32 %17)
%45 = call i32 @gpio_unexport(i32 %0)
br label %73
46: ; preds = %39
%47 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %3, i64 0, i32 1, i32 0
%48 = load i32, i32* %47
%49 = load i32, i32* @SEEK_SET
%50 = call i32 @lseek(i32 %48, i32 0, i32 %49)
%51 = load i32, i32* %47
%52 = call i32 @read(i32 %51, i8* %5, i32 1)
%53 = icmp eq i32 %52, 1
br i1 %53, label %60, label %54
54: ; preds = %46
%55 = load i32, i32* @EPOLL_CTL_DEL
%56 = call i32 @epoll_ctl(i32 %11, i32 %55, i32 %17, %struct.epoll_event* %4)
%57 = call i32 @close(i32 %17)
%58 = call i32 @gpio_unexport(i32 %0)
%59 = call i32 @close(i32 %11)
br label %73
60: ; preds = %46
%61 = load i32, i32* %47
%62 = icmp eq i32 %61, %17
br i1 %62, label %68, label %63
63: ; preds = %60
%64 = load i32, i32* @EPOLL_CTL_DEL
%65 = call i32 @epoll_ctl(i32 %11, i32 %64, i32 %17, %struct.epoll_event* %4)
%66 = call i32 @close(i32 %17)
%67 = call i32 @gpio_unexport(i32 %0)
br label %73
68: ; preds = %60, %39
%69 = load i32, i32* @EPOLL_CTL_DEL
%70 = call i32 @epoll_ctl(i32 %11, i32 %69, i32 %17, %struct.epoll_event* %4)
%71 = call i32 @close(i32 %17)
%72 = call i32 @gpio_unexport(i32 %0)
br label %73
73: ; preds = %13, %10, %2, %68, %63, %54, %41, %33
%74 = phi i32 [ 4, %33 ], [ 5, %41 ], [ 6, %54 ], [ 7, %63 ], [ 0, %68 ], [ 1, %2 ], [ 2, %10 ], [ 3, %13 ]
ret i32 %74
}