#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_export(int);
int gpio_fd_open(int);
int gpio_set_active_low(int, int /*<<< orphan*/);
int gpio_set_edge(int, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ wait_event(int *);
int main() {
  int i, rc;
  int pins[4] = {17, 18, 27, 22};
  int fds[4] = {0, 0, 0, 0};
  printf("pins    ", pins[i]);
  for (i = 0; i < 4; i++) {
    printf(" %2d", pins[i]);
  }
  printf("\n");
  printf("export  ", pins[i]);
  for (i = 0; i < 4; i++) {
    rc = gpio_export(pins[i]);
    printf(" %2d", rc);
  }
  printf("\n");
  printf("edge    ");
  for (i = 0; i < 4; i++) {
    rc = gpio_set_edge(pins[i], "rising");
    printf(" %2d", rc);
  }
  printf("\n");
  printf("low     ");
  for (i = 0; i < 4; i++) {
    rc = gpio_set_active_low(pins[i], 0);
    printf(" %2d", rc);
  }
  printf("\n");
  printf("fds     ");
  for (i = 0; i < 4; i++) {
    fds[i] = gpio_fd_open(pins[i]);
    printf(" %2d", fds[i]);
  }
  printf("\n");
  printf("waiting 300 sec for event\n");
  while (1) {
    wait_event(fds);
    usleep(50000);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe6a(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe67(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1200 <main+0x80>
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d2 <main+0x52>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1264 <main+0xe4>
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
call   1050 <gpio_export@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    122b <main+0xab>
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    12c7 <main+0x147>
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
lea    0xd90(%rip),%rsi
call   1080 <gpio_set_edge@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1287 <main+0x107>
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1325 <main+0x1a5>
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
xor    %esi,%esi
call   1090 <gpio_set_active_low@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd09(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12ea <main+0x16a>
lea    0xd36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    138d <main+0x20d>
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
call   1070 <gpio_fd_open@plt>
mov    %eax,%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xca1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1348 <main+0x1c8>
lea    0xcce(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xca7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1030 <wait_event@plt>
mov    $0xc350,%edi
call   10a0 <usleep@plt>
jmp    13a9 <main+0x229>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe62(%rip),%rdi
mov    $0x11,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe58(%rip),%r14
mov    %r14,%rdi
mov    $0x11,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    $0x12,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    $0x1b,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    $0x16,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe10(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x11,%edi
call   1070 <gpio_export@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x12,%edi
call   1070 <gpio_export@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1b,%edi
call   1070 <gpio_export@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x16,%edi
call   1070 <gpio_export@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xda9(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xda4(%rip),%rbx
mov    $0x11,%edi
mov    %rbx,%rsi
call   1090 <gpio_set_edge@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x12,%edi
mov    %rbx,%rsi
call   1090 <gpio_set_edge@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1b,%edi
mov    %rbx,%rsi
call   1090 <gpio_set_edge@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x16,%edi
mov    %rbx,%rsi
call   1090 <gpio_set_edge@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd36(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x11,%edi
xor    %esi,%esi
call   10a0 <gpio_set_active_low@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x12,%edi
xor    %esi,%esi
call   10a0 <gpio_set_active_low@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1b,%edi
xor    %esi,%esi
call   10a0 <gpio_set_active_low@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x16,%edi
xor    %esi,%esi
call   10a0 <gpio_set_active_low@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xcc7(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x11,%edi
call   1080 <gpio_fd_open@plt>
mov    %eax,(%rsp)
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x12,%edi
call   1080 <gpio_fd_open@plt>
mov    %eax,0x4(%rsp)
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1b,%edi
call   1080 <gpio_fd_open@plt>
mov    %eax,0x8(%rsp)
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x16,%edi
call   1080 <gpio_fd_open@plt>
mov    %eax,0xc(%rsp)
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc51(%rip),%rdi
call   1050 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <wait_event@plt>
mov    $0xc350,%edi
call   10b0 <usleep@plt>
jmp    13f0 <main+0x260>

LLVM IR (-O0):
@__const.main.pins = [4 x i32] [i32 17, i32 18, i32 27, i32 22]
@.str = [9 x i8] c"pins \00"
@.str.1 = [5 x i8] c" %2d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [9 x i8] c"export \00"
@.str.4 = [9 x i8] c"edge \00"
@.str.5 = [7 x i8] c"rising\00"
@.str.6 = [9 x i8] c"low \00"
@.str.7 = [9 x i8] c"fds \00"
@.str.8 = [27 x i8] c"waiting 300 sec for event\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [4 x i32]
%5 = alloca [4 x i32]
store i32 0, i32* %1
%6 = bitcast [4 x i32]* %4 to i8*
%7 = bitcast [4 x i32]* %5 to i8*
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 0, i32* %2
br label %13
13: ; preds = %22, %0
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 4
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %16
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %13
25: ; preds = %13
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32, i32* %2
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %30)
store i32 0, i32* %2
br label %32
32: ; preds = %43, %25
%33 = load i32, i32* %2
%34 = icmp slt i32 %33, 4
br i1 %34, label %35, label %46
35: ; preds = %32
%36 = load i32, i32* %2
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = call i32 @gpio_export(i32 %39)
store i32 %40, i32* %3
%41 = load i32, i32* %3
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %35
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
br label %32
46: ; preds = %32
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %2
br label %49
49: ; preds = %60, %46
%50 = load i32, i32* %2
%51 = icmp slt i32 %50, 4
br i1 %51, label %52, label %63
52: ; preds = %49
%53 = load i32, i32* %2
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = call i32 @gpio_set_edge(i32 %56, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
store i32 %57, i32* %3
%58 = load i32, i32* %3
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %58)
br label %60
60: ; preds = %52
%61 = load i32, i32* %2
%62 = add nsw i32 %61, 1
store i32 %62, i32* %2
br label %49
63: ; preds = %49
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %2
br label %66
66: ; preds = %77, %63
%67 = load i32, i32* %2
%68 = icmp slt i32 %67, 4
br i1 %68, label %69, label %80
69: ; preds = %66
%70 = load i32, i32* %2
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 %71
%73 = load i32, i32* %72
%74 = call i32 @gpio_set_active_low(i32 %73, i32 0)
store i32 %74, i32* %3
%75 = load i32, i32* %3
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %75)
br label %77
77: ; preds = %69
%78 = load i32, i32* %2
%79 = add nsw i32 %78, 1
store i32 %79, i32* %2
br label %66
80: ; preds = %66
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %2
br label %83
83: ; preds = %100, %80
%84 = load i32, i32* %2
%85 = icmp slt i32 %84, 4
br i1 %85, label %86, label %103
86: ; preds = %83
%87 = load i32, i32* %2
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 %88
%90 = load i32, i32* %89
%91 = call i32 @gpio_fd_open(i32 %90)
%92 = load i32, i32* %2
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %93
store i32 %91, i32* %94
%95 = load i32, i32* %2
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %96
%98 = load i32, i32* %97
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %98)
br label %100
100: ; preds = %86
%101 = load i32, i32* %2
%102 = add nsw i32 %101, 1
store i32 %102, i32* %2
br label %83
103: ; preds = %83
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
br label %106
106: ; preds = %103, %106
%107 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%108 = call i32 @wait_event(i32* %107)
%109 = call i32 @usleep(i32 50000)
br label %106
}

LLVM IR (-O2):
@.str = [9 x i8] c"pins \00"
@.str.1 = [5 x i8] c" %2d\00"
@.str.3 = [9 x i8] c"export \00"
@.str.4 = [9 x i8] c"edge \00"
@.str.5 = [7 x i8] c"rising\00"
@.str.6 = [9 x i8] c"low \00"
@.str.7 = [9 x i8] c"fds \00"
@str = [26 x i8] c"waiting 300 sec for event\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 17)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 17)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 18)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 27)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 22)
%8 = tail call i32 @putchar(i32 10)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 undef)
%10 = tail call i32 @gpio_export(i32 17)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = tail call i32 @gpio_export(i32 18)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = tail call i32 @gpio_export(i32 27)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = tail call i32 @gpio_export(i32 22)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = tail call i32 @putchar(i32 10)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%20 = tail call i32 @gpio_set_edge(i32 17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = tail call i32 @gpio_set_edge(i32 18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = tail call i32 @gpio_set_edge(i32 27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = tail call i32 @gpio_set_edge(i32 22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = tail call i32 @putchar(i32 10)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%30 = tail call i32 @gpio_set_active_low(i32 17, i32 0)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = tail call i32 @gpio_set_active_low(i32 18, i32 0)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = tail call i32 @gpio_set_active_low(i32 27, i32 0)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = tail call i32 @gpio_set_active_low(i32 22, i32 0)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = tail call i32 @putchar(i32 10)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%40 = tail call i32 @gpio_fd_open(i32 17)
%41 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
store i32 %40, i32* %41
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%43 = tail call i32 @gpio_fd_open(i32 18)
%44 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
store i32 %43, i32* %44
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %43)
%46 = tail call i32 @gpio_fd_open(i32 27)
%47 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
store i32 %46, i32* %47
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%49 = tail call i32 @gpio_fd_open(i32 22)
%50 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
store i32 %49, i32* %50
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %49)
%52 = tail call i32 @putchar(i32 10)
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %54
54: ; preds = %54, %0
%55 = call i32 @wait_event(i32* %41)
%56 = call i32 @usleep(i32 50000)
br label %54
}