#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 */
struct sched_param {
  int sched_priority;
};
struct pollfd {
  int fd;
  int events;
  int revents;
};
typedef int /*<<< orphan*/ fdset;

/* Variables and functions */
int POLLERR;
int POLLPRI;
int /*<<< orphan*/ SCHED_FIFO;
int STDIN_FILENO;
void *atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ gpio_export(unsigned int);
int /*<<< orphan*/ gpio_fd_close(int);
int gpio_fd_open(unsigned int);
int /*<<< orphan*/ gpio_set_dir(unsigned int, int);
int /*<<< orphan*/ gpio_set_edge(unsigned int, char *);
int /*<<< orphan*/ gpio_set_value(unsigned int, int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int poll(struct pollfd *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char **, int);
int sched_setscheduler(int /*<<< orphan*/, int /*<<< orphan*/,
                       struct sched_param *);
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv, char **envp) {
  struct pollfd fdset[2];
  int nfds = 2;
  int gpio_fd, out_fd, timeout, rc, delay, prio;
  char *buf[64];
  unsigned int gpio;
  unsigned int outgpio;
  int len;
  struct sched_param param;
  if (argc < 5) {
    printf("Usage: int2gpio <int-pin> <gpio-pin> <udelay> <prio>\n\n");
    printf("Waits for a change in the INT pin or input on stdin\nThen set GPIO "
           "pin, wait delay, then reset it.\n");
    exit(-1);
  }
  gpio = atoi(argv[1]);
  outgpio = atoi(argv[2]);
  delay = atoi(argv[3]);
  prio = atoi(argv[4]);
  printf("using priority: %d\n", prio);
  param.sched_priority = prio;
  if (sched_setscheduler(0, SCHED_FIFO, &param) == -1) {
    perror("sched_setscheduler failed");
    exit(-1);
  }
  gpio_export(gpio);
  gpio_set_dir(gpio, 0);
  gpio_set_edge(gpio, "rising");
  gpio_fd = gpio_fd_open(gpio);
  gpio_export(outgpio);
  gpio_set_dir(outgpio, 1);
  timeout = (-1);
  while (1) {
    memset((void *)fdset, 0, sizeof(fdset));
    fdset[0].fd = STDIN_FILENO;
    fdset[0].events = POLLERR;
    fdset[1].fd = gpio_fd;
    fdset[1].events = (POLLPRI | POLLERR);
    rc = poll(fdset, nfds, timeout);
    if (rc < 0) {
      printf("\npoll() failed!\n");
      return -1;
    }
    if (rc == 0) {
      printf(".");
    }
    if (fdset[1].revents & (POLLPRI | POLLERR)) {
      len = read(fdset[1].fd, buf, 64);
      gpio_set_value(outgpio, 1);
      usleep(delay);
      gpio_set_value(outgpio, 0);
    }
  }
  gpio_fd_close(gpio_fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x2,-0x34(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1234 <main+0x54>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x254(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x258(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%esi
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x260(%rbp)
mov    0x2d3d(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x260(%rbp),%rdx
call   1060 <sched_setscheduler@plt>
cmp    $0xffffffff,%eax
jne    12ca <main+0xea>
lea    0xdf3(%rip),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%edi
call   10f0 <exit@plt>
mov    -0x254(%rbp),%edi
call   1050 <gpio_export@plt>
mov    -0x254(%rbp),%edi
xor    %esi,%esi
call   1030 <gpio_set_dir@plt>
mov    -0x254(%rbp),%edi
lea    0xdd9(%rip),%rsi
call   1090 <gpio_set_edge@plt>
mov    -0x254(%rbp),%edi
call   1080 <gpio_fd_open@plt>
mov    %eax,-0x38(%rbp)
mov    -0x258(%rbp),%edi
call   1050 <gpio_export@plt>
mov    -0x258(%rbp),%edi
mov    $0x1,%esi
call   1030 <gpio_set_dir@plt>
movl   $0xffffffff,-0x40(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
mov    0x2c8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2c99(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x2c97(%rip),%rax
mov    (%rax),%eax
mov    0x2c7e(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x40(%rbp),%edx
call   10b0 <poll@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jge    139f <main+0x1bf>
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%eax
add    $0x260,%rsp
pop    %rbp
ret
cmpl   $0x0,-0x44(%rbp)
jne    13b7 <main+0x1d7>
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    0x2c2f(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2c16(%rip),%rdx
or     (%rdx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1416 <main+0x236>
mov    -0x24(%rbp),%edi
lea    -0x250(%rbp),%rsi
mov    $0x40,%edx
call   10a0 <read@plt>
mov    %eax,-0x25c(%rbp)
mov    -0x258(%rbp),%edi
mov    $0x1,%esi
call   10c0 <gpio_set_value@plt>
mov    -0x48(%rbp),%edi
call   1100 <usleep@plt>
mov    -0x258(%rbp),%edi
xor    %esi,%esi
call   10c0 <gpio_set_value@plt>
jmp    1324 <main+0x144>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
cmp    $0x4,%edi
jle    1395 <main+0x195>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
call   1100 <atoi@plt>
mov    %rax,%rbx
mov    0x10(%rbp),%rdi
call   1100 <atoi@plt>
mov    %rax,%r15
mov    0x18(%rbp),%rdi
call   1100 <atoi@plt>
mov    %rax,0x28(%rsp)
mov    0x20(%rbp),%rdi
call   1100 <atoi@plt>
mov    %rax,%rbp
lea    0xdaa(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,0x8(%rsp)
mov    0x2d6e(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
xor    %edi,%edi
call   1080 <sched_setscheduler@plt>
cmp    $0xffffffff,%eax
je     13b7 <main+0x1b7>
mov    %ebx,%edi
call   1070 <gpio_export@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1050 <gpio_set_dir@plt>
lea    0xd96(%rip),%rsi
mov    %ebx,%edi
call   10b0 <gpio_set_edge@plt>
mov    %ebx,%edi
call   10a0 <gpio_fd_open@plt>
mov    %eax,%ebp
mov    %r15d,%edi
call   1070 <gpio_export@plt>
mov    %r15d,%edi
mov    $0x1,%esi
call   1050 <gpio_set_dir@plt>
lea    0x10(%rsp),%rbx
mov    0x2cff(%rip),%r13
mov    0x2d10(%rip),%r12
mov    0x2d19(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1090 <memset@plt>
mov    0x0(%r13),%eax
mov    %eax,0x10(%rsp)
mov    (%r12),%eax
mov    %eax,0x14(%rsp)
mov    %ebp,0x1c(%rsp)
or     (%r14),%eax
mov    %eax,0x20(%rsp)
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   10d0 <poll@plt>
test   %eax,%eax
js     1372 <main+0x172>
jne    132c <main+0x12c>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    (%r12),%eax
or     (%r14),%eax
test   %eax,0x24(%rsp)
je     12e0 <main+0xe0>
mov    0x1c(%rsp),%edi
lea    0x30(%rsp),%rsi
mov    $0x40,%edx
call   10c0 <read@plt>
mov    %r15d,%edi
mov    $0x1,%esi
call   10e0 <gpio_set_value@plt>
mov    0x28(%rsp),%rdi
call   1120 <usleep@plt>
mov    %r15d,%edi
xor    %esi,%esi
call   10e0 <gpio_set_value@plt>
jmp    12e0 <main+0xe0>
lea    0xcbc(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xca9(%rip),%rdi
call   1040 <puts@plt>
lea    0xcd3(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>
lea    0xc56(%rip),%rdi
call   10f0 <perror@plt>
mov    $0xffffffff,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
%struct.pollfd = type { i32, i32, i32 }
%struct.sched_param = type { i32 }
@.str = [55 x i8] c"Usage: int2gpio <int-pin> <gpio-pin> <udelay> <prio>\0A\0A\00"
@.str.1 = [99 x i8] c"Waits for a change in the INT pin or input on stdin\0AThen set GPIO pin, wait delay, then reset it.\0A\00"
@.str.2 = [20 x i8] c"using priority: %d\0A\00"
@SCHED_FIFO = global i32 0
@.str.3 = [26 x i8] c"sched_setscheduler failed\00"
@.str.4 = [7 x i8] c"rising\00"
@STDIN_FILENO = global i32 0
@POLLERR = global i32 0
@POLLPRI = global i32 0
@.str.5 = [17 x i8] c"\0Apoll() failed!\0A\00"
@.str.6 = [2 x i8] c".\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca [2 x %struct.pollfd]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [64 x i8*]
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca %struct.sched_param
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32 2, i32* %9
%21 = load i32, i32* %5
%22 = icmp slt i32 %21, 5
br i1 %22, label %23, label %27
23: ; preds = %3
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 @exit(i32 -1)
unreachable
27: ; preds = %3
%28 = load i8**, i8*** %6
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i8* @atoi(i8* %30)
%32 = ptrtoint i8* %31 to i32
store i32 %32, i32* %17
%33 = load i8**, i8*** %6
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call i8* @atoi(i8* %35)
%37 = ptrtoint i8* %36 to i32
store i32 %37, i32* %18
%38 = load i8**, i8*** %6
%39 = getelementptr inbounds i8*, i8** %38, i64 3
%40 = load i8*, i8** %39
%41 = call i8* @atoi(i8* %40)
%42 = ptrtoint i8* %41 to i32
store i32 %42, i32* %14
%43 = load i8**, i8*** %6
%44 = getelementptr inbounds i8*, i8** %43, i64 4
%45 = load i8*, i8** %44
%46 = call i8* @atoi(i8* %45)
%47 = ptrtoint i8* %46 to i32
store i32 %47, i32* %15
%48 = load i32, i32* %15
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %15
%51 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %20, i32 0, i32 0
store i32 %50, i32* %51
%52 = load i32, i32* @SCHED_FIFO
%53 = call i32 @sched_setscheduler(i32 0, i32 %52, %struct.sched_param* %20)
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %58
55: ; preds = %27
%56 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%57 = call i32 @exit(i32 -1)
unreachable
58: ; preds = %27
%59 = load i32, i32* %17
%60 = call i32 @gpio_export(i32 %59)
%61 = load i32, i32* %17
%62 = call i32 @gpio_set_dir(i32 %61, i32 0)
%63 = load i32, i32* %17
%64 = call i32 @gpio_set_edge(i32 %63, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%65 = load i32, i32* %17
%66 = call i32 @gpio_fd_open(i32 %65)
store i32 %66, i32* %10
%67 = load i32, i32* %18
%68 = call i32 @gpio_export(i32 %67)
%69 = load i32, i32* %18
%70 = call i32 @gpio_set_dir(i32 %69, i32 1)
store i32 -1, i32* %12
br label %71
71: ; preds = %58, %123
%72 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %8, i64 0, i64 0
%73 = bitcast %struct.pollfd* %72 to i8*
%74 = call i32 @memset(i8* %73, i32 0, i32 24)
%75 = load i32, i32* @STDIN_FILENO
%76 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %8, i64 0, i64 0
%77 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %76, i32 0, i32 0
store i32 %75, i32* %77
%78 = load i32, i32* @POLLERR
%79 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %8, i64 0, i64 0
%80 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %79, i32 0, i32 1
store i32 %78, i32* %80
%81 = load i32, i32* %10
%82 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %8, i64 0, i64 1
%83 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %82, i32 0, i32 0
store i32 %81, i32* %83
%84 = load i32, i32* @POLLPRI
%85 = load i32, i32* @POLLERR
%86 = or i32 %84, %85
%87 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %8, i64 0, i64 1
%88 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %87, i32 0, i32 1
store i32 %86, i32* %88
%89 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %8, i64 0, i64 0
%90 = load i32, i32* %9
%91 = load i32, i32* %12
%92 = call i32 @poll(%struct.pollfd* %89, i32 %90, i32 %91)
store i32 %92, i32* %13
%93 = load i32, i32* %13
%94 = icmp slt i32 %93, 0
br i1 %94, label %95, label %97
95: ; preds = %71
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
ret i32 -1
97: ; preds = %71
%98 = load i32, i32* %13
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %102
100: ; preds = %97
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %102
102: ; preds = %100, %97
%103 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %8, i64 0, i64 1
%104 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %103, i32 0, i32 2
%105 = load i32, i32* %104
%106 = load i32, i32* @POLLPRI
%107 = load i32, i32* @POLLERR
%108 = or i32 %106, %107
%109 = and i32 %105, %108
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %123
111: ; preds = %102
%112 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %8, i64 0, i64 1
%113 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %112, i32 0, i32 0
%114 = load i32, i32* %113
%115 = getelementptr inbounds [64 x i8*], [64 x i8*]* %16, i64 0, i64 0
%116 = call i32 @read(i32 %114, i8** %115, i32 64)
store i32 %116, i32* %19
%117 = load i32, i32* %18
%118 = call i32 @gpio_set_value(i32 %117, i32 1)
%119 = load i32, i32* %14
%120 = call i32 @usleep(i32 %119)
%121 = load i32, i32* %18
%122 = call i32 @gpio_set_value(i32 %121, i32 0)
br label %123
123: ; preds = %111, %102
br label %71
}

LLVM IR (-O2):
%struct.pollfd = type { i32, i32, i32 }
%struct.sched_param = type { i32 }
@.str.2 = [20 x i8] c"using priority: %d\0A\00"
@SCHED_FIFO = global i32 0
@.str.3 = [26 x i8] c"sched_setscheduler failed\00"
@.str.4 = [7 x i8] c"rising\00"
@STDIN_FILENO = global i32 0
@POLLERR = global i32 0
@POLLPRI = global i32 0
@str = [16 x i8] c"\0Apoll() failed!\00"
@str.7 = [54 x i8] c"Usage: int2gpio <int-pin> <gpio-pin> <udelay> <prio>\0A\00"
@str.8 = [98 x i8] c"Waits for a change in the INT pin or input on stdin\0AThen set GPIO pin, wait delay, then reset it.\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture readnone %2) {
%4 = alloca [2 x %struct.pollfd]
%5 = alloca [64 x i8*]
%6 = alloca %struct.sched_param
%7 = bitcast [2 x %struct.pollfd]* %4 to i8*
%8 = bitcast [64 x i8*]* %5 to i8*
%9 = bitcast %struct.sched_param* %6 to i8*
%10 = icmp slt i32 %0, 5
br i1 %10, label %11, label %15
11: ; preds = %3
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.7, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @str.8, i64 0, i64 0))
%14 = tail call i32 @exit(i32 -1)
unreachable
15: ; preds = %3
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i8* @atoi(i8* %17)
%19 = ptrtoint i8* %18 to i64
%20 = trunc i64 %19 to i32
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = tail call i8* @atoi(i8* %22)
%24 = ptrtoint i8* %23 to i64
%25 = trunc i64 %24 to i32
%26 = getelementptr inbounds i8*, i8** %1, i64 3
%27 = load i8*, i8** %26
%28 = tail call i8* @atoi(i8* %27)
%29 = ptrtoint i8* %28 to i64
%30 = trunc i64 %29 to i32
%31 = getelementptr inbounds i8*, i8** %1, i64 4
%32 = load i8*, i8** %31
%33 = tail call i8* @atoi(i8* %32)
%34 = ptrtoint i8* %33 to i64
%35 = trunc i64 %34 to i32
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %6, i64 0, i32 0
store i32 %35, i32* %37
%38 = load i32, i32* @SCHED_FIFO
%39 = call i32 @sched_setscheduler(i32 0, i32 %38, %struct.sched_param* %6)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %44
41: ; preds = %15
%42 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%43 = call i32 @exit(i32 -1)
unreachable
44: ; preds = %15
%45 = call i32 @gpio_export(i32 %20)
%46 = call i32 @gpio_set_dir(i32 %20, i32 0)
%47 = call i32 @gpio_set_edge(i32 %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%48 = call i32 @gpio_fd_open(i32 %20)
%49 = call i32 @gpio_export(i32 %25)
%50 = call i32 @gpio_set_dir(i32 %25, i32 1)
%51 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %4, i64 0, i64 0
%52 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %4, i64 0, i64 0, i32 0
%53 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %4, i64 0, i64 0, i32 1
%54 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %4, i64 0, i64 1, i32 0
%55 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %4, i64 0, i64 1, i32 1
%56 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %4, i64 0, i64 1, i32 2
%57 = getelementptr inbounds [64 x i8*], [64 x i8*]* %5, i64 0, i64 0
br label %58
58: ; preds = %85, %44
%59 = call i32 @memset(i8* %7, i32 0, i32 24)
%60 = load i32, i32* @STDIN_FILENO
store i32 %60, i32* %52
%61 = load i32, i32* @POLLERR
store i32 %61, i32* %53
store i32 %48, i32* %54
%62 = load i32, i32* @POLLPRI
%63 = or i32 %62, %61
store i32 %63, i32* %55
%64 = call i32 @poll(%struct.pollfd* %51, i32 2, i32 -1)
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %58
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret i32 -1
68: ; preds = %58
%69 = icmp eq i32 %64, 0
br i1 %69, label %70, label %72
70: ; preds = %68
%71 = call i32 @putchar(i32 46)
br label %72
72: ; preds = %70, %68
%73 = load i32, i32* %56
%74 = load i32, i32* @POLLPRI
%75 = load i32, i32* @POLLERR
%76 = or i32 %75, %74
%77 = and i32 %76, %73
%78 = icmp eq i32 %77, 0
br i1 %78, label %85, label %79
79: ; preds = %72
%80 = load i32, i32* %54
%81 = call i32 @read(i32 %80, i8** %57, i32 64)
%82 = call i32 @gpio_set_value(i32 %25, i32 1)
%83 = call i32 @usleep(i32 %30)
%84 = call i32 @gpio_set_value(i32 %25, i32 0)
br label %85
85: ; preds = %79, %72
br label %58
}