#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 */
typedef int /*<<< orphan*/ gpiostr;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
scalar_t__ EBUSY;
int O_NONBLOCK;
int O_RDONLY;
int O_SYNC;
int O_WRONLY;
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ is_gpio_valid(int);
int open(char *, int);
int open_write_close(char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ unexport_sysfs_gpio(int);
int setup_sysfs_gpio(int gpio, int is_output, int init_high) {
  char buf[40];
  char gpiostr[4];
  int ret;
  if (!is_gpio_valid(gpio))
    return (-1);
  snprintf(gpiostr, sizeof(gpiostr), "%d", gpio);
  ret = open_write_close("/sys/class/gpio/export", gpiostr);
  if (ret < 0) {
    if (errno == EBUSY) {
      do {
        fprintf(stderr, "gpio %d is already exported", gpio);
        fputc('\n', stderr);
      } while (0);
    } else {
      do {
        fprintf(stderr, "Couldn't export gpio %d", gpio);
        fputc('\n', stderr);
      } while (0);
      perror("sysfsgpio: ");
      return (-2);
    }
  }
  snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%d/direction", gpio);
  ret = open_write_close(buf, is_output ? (init_high ? "high" : "low") : "in");
  if (ret < 0) {
    do {
      fprintf(stderr, "Couldn't set direction for gpio %d", gpio);
      fputc('\n', stderr);
    } while (0);
    perror("sysfsgpio: ");
    unexport_sysfs_gpio(gpio);
    return (-2);
  }
  snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%d/value", gpio);
  if (is_output)
    ret = open(buf, O_WRONLY | O_NONBLOCK | O_SYNC);
  else
    ret = open(buf, O_RDONLY | O_NONBLOCK | O_SYNC);
  if (ret < 0)
    unexport_sysfs_gpio(gpio);
  return ret;
}


x86 assembly (clang, -O0):
<setup_sysfs_gpio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1080 <is_gpio_valid@plt>
cmp    $0x0,%eax
jne    11ae <setup_sysfs_gpio+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    13d1 <setup_sysfs_gpio+0x251>
lea    -0x44(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    $0x4,%esi
lea    0xee3(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x44(%rbp),%rsi
lea    0xe2f(%rip),%rdi
call   1040 <open_write_close@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jge    127f <setup_sysfs_gpio+0xff>
mov    0x2dd6(%rip),%rax
mov    (%rax),%rax
mov    0x2dc4(%rip),%rcx
cmp    (%rcx),%rax
jne    1232 <setup_sysfs_gpio+0xb2>
jmp    1202 <setup_sysfs_gpio+0x82>
mov    0x2dbf(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xe02(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2da7(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1060 <fputc@plt>
jmp    127a <setup_sysfs_gpio+0xfa>
jmp    1237 <setup_sysfs_gpio+0xb7>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xde9(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1060 <fputc@plt>
lea    0xde2(%rip),%rdi
call   10a0 <perror@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    13d1 <setup_sysfs_gpio+0x251>
jmp    127f <setup_sysfs_gpio+0xff>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    $0x28,%esi
lea    0xdc5(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     12ca <setup_sysfs_gpio+0x14a>
mov    -0x10(%rbp),%edx
lea    0xdca(%rip),%rax
lea    0xdbe(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x58(%rbp)
jmp    12da <setup_sysfs_gpio+0x15a>
lea    0xdb0(%rip),%rax
mov    %rax,-0x58(%rbp)
jmp    12da <setup_sysfs_gpio+0x15a>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   1040 <open_write_close@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jge    1344 <setup_sysfs_gpio+0x1c4>
jmp    12f9 <setup_sysfs_gpio+0x179>
mov    0x2cc8(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xd78(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2cb0(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1060 <fputc@plt>
lea    0xd20(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x8(%rbp),%edi
call   1030 <unexport_sysfs_gpio@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    13d1 <setup_sysfs_gpio+0x251>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    $0x28,%esi
lea    0xd50(%rip),%rdx
call   1050 <snprintf@plt>
cmpl   $0x0,-0xc(%rbp)
je     1392 <setup_sysfs_gpio+0x212>
lea    -0x40(%rbp),%rdi
mov    0x2c37(%rip),%rax
mov    (%rax),%esi
mov    0x2c66(%rip),%rax
or     (%rax),%esi
mov    0x2c65(%rip),%rax
or     (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x48(%rbp)
jmp    13b9 <setup_sysfs_gpio+0x239>
lea    -0x40(%rbp),%rdi
mov    0x2c3b(%rip),%rax
mov    (%rax),%esi
mov    0x2c3a(%rip),%rax
or     (%rax),%esi
mov    0x2c39(%rip),%rax
or     (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jge    13cb <setup_sysfs_gpio+0x24b>
mov    -0x8(%rbp),%edi
call   1030 <unexport_sysfs_gpio@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_sysfs_gpio>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
call   1080 <is_gpio_valid@plt>
test   %eax,%eax
je     127f <setup_sysfs_gpio+0xff>
lea    0xefe(%rip),%rdx
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x4,%esi
mov    %ebx,%ecx
call   1050 <snprintf@plt>
lea    0xe3f(%rip),%rdi
mov    %rbp,%rsi
call   1040 <open_write_close@plt>
test   %eax,%eax
jns    120c <setup_sysfs_gpio+0x8c>
mov    0x2dec(%rip),%rax
mov    (%rax),%rax
mov    0x2dda(%rip),%rcx
mov    0x2de3(%rip),%rbp
mov    0x0(%rbp),%edi
cmp    (%rcx),%rax
jne    1302 <setup_sysfs_gpio+0x182>
lea    0xe1f(%rip),%rsi
mov    %ebx,%edx
call   1070 <fprintf@plt>
mov    0x0(%rbp),%esi
mov    $0xa,%edi
call   1060 <fputc@plt>
lea    0xe44(%rip),%rdx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x28,%esi
mov    %ebx,%ecx
call   1050 <snprintf@plt>
test   %r14d,%r14d
lea    0xe4c(%rip),%rax
lea    0xe40(%rip),%rcx
cmove  %rax,%rcx
test   %r15d,%r15d
lea    0xe3b(%rip),%rsi
cmovne %rcx,%rsi
mov    %rbp,%rdi
call   1040 <open_write_close@plt>
test   %eax,%eax
js     12c3 <setup_sysfs_gpio+0x143>
lea    0xe4a(%rip),%rdx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x28,%esi
mov    %ebx,%ecx
call   1050 <snprintf@plt>
test   %r15d,%r15d
jne    1286 <setup_sysfs_gpio+0x106>
mov    0x2d5b(%rip),%rax
jmp    128d <setup_sysfs_gpio+0x10d>
mov    $0xffffffff,%ebp
jmp    12b6 <setup_sysfs_gpio+0x136>
mov    0x2d1b(%rip),%rax
mov    0x2d4c(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d49(%rip),%rax
or     (%rax),%esi
mov    %r14,%rdi
call   1090 <open@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    12b6 <setup_sysfs_gpio+0x136>
mov    %ebx,%edi
call   1030 <unexport_sysfs_gpio@plt>
mov    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cfe(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xdb0(%rip),%rsi
mov    %ebx,%edx
call   1070 <fprintf@plt>
mov    0x0(%rbp),%esi
mov    $0xa,%edi
call   1060 <fputc@plt>
lea    0xd5c(%rip),%rdi
call   10a0 <perror@plt>
mov    %ebx,%edi
call   1030 <unexport_sysfs_gpio@plt>
mov    $0xfffffffe,%ebp
jmp    12b6 <setup_sysfs_gpio+0x136>
lea    0xd2a(%rip),%rsi
mov    %ebx,%edx
call   1070 <fprintf@plt>
mov    0x0(%rbp),%esi
mov    $0xa,%edi
call   1060 <fputc@plt>
lea    0xd27(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xfffffffe,%ebp
jmp    12b6 <setup_sysfs_gpio+0x136>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [23 x i8] c"/sys/class/gpio/export\00"
@errno = global i64 0
@EBUSY = global i64 0
@stderr = global i32 0
@.str.2 = [28 x i8] c"gpio %d is already exported\00"
@.str.3 = [24 x i8] c"Couldn't export gpio %d\00"
@.str.4 = [12 x i8] c"sysfsgpio: \00"
@.str.5 = [33 x i8] c"/sys/class/gpio/gpio%d/direction\00"
@.str.6 = [5 x i8] c"high\00"
@.str.7 = [4 x i8] c"low\00"
@.str.8 = [3 x i8] c"in\00"
@.str.9 = [35 x i8] c"Couldn't set direction for gpio %d\00"
@.str.10 = [29 x i8] c"/sys/class/gpio/gpio%d/value\00"
@O_WRONLY = global i32 0
@O_NONBLOCK = global i32 0
@O_SYNC = global i32 0
@O_RDONLY = global i32 0
define i32 @setup_sysfs_gpio(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [40 x i8]
%9 = alloca [4 x i8]
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%11 = load i32, i32* %5
%12 = call i32 @is_gpio_valid(i32 %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %3
store i32 -1, i32* %4
br label %104
15: ; preds = %3
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%17 = load i32, i32* %5
%18 = call i32 @snprintf(i8* %16, i32 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%20 = call i32 @open_write_close(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %19)
store i32 %20, i32* %10
%21 = load i32, i32* %10
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %45
23: ; preds = %15
%24 = load i64, i64* @errno
%25 = load i64, i64* @EBUSY
%26 = icmp eq i64 %24, %25
br i1 %26, label %27, label %35
27: ; preds = %23
br label %28
28: ; preds = %27
%29 = load i32, i32* @stderr
%30 = load i32, i32* %5
%31 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load i32, i32* @stderr
%33 = call i32 @fputc(i8 signext 10, i32 %32)
br label %34
34: ; preds = %28
br label %44
35: ; preds = %23
br label %36
36: ; preds = %35
%37 = load i32, i32* @stderr
%38 = load i32, i32* %5
%39 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = load i32, i32* @stderr
%41 = call i32 @fputc(i8 signext 10, i32 %40)
br label %42
42: ; preds = %36
%43 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
store i32 -2, i32* %4
br label %104
44: ; preds = %34
br label %45
45: ; preds = %44, %15
%46 = getelementptr inbounds [40 x i8], [40 x i8]* %8, i64 0, i64 0
%47 = load i32, i32* %5
%48 = call i32 @snprintf(i8* %46, i32 40, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [40 x i8], [40 x i8]* %8, i64 0, i64 0
%50 = load i32, i32* %6
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %45
%53 = load i32, i32* %7
%54 = icmp ne i32 %53, 0
%55 = zext i1 %54 to i64
%56 = select i1 %54, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0)
br label %58
57: ; preds = %45
br label %58
58: ; preds = %57, %52
%59 = phi i8* [ %56, %52 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), %57 ]
%60 = call i32 @open_write_close(i8* %49, i8* %59)
store i32 %60, i32* %10
%61 = load i32, i32* %10
%62 = icmp slt i32 %61, 0
br i1 %62, label %63, label %74
63: ; preds = %58
br label %64
64: ; preds = %63
%65 = load i32, i32* @stderr
%66 = load i32, i32* %5
%67 = call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0), i32 %66)
%68 = load i32, i32* @stderr
%69 = call i32 @fputc(i8 signext 10, i32 %68)
br label %70
70: ; preds = %64
%71 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%72 = load i32, i32* %5
%73 = call i32 @unexport_sysfs_gpio(i32 %72)
store i32 -2, i32* %4
br label %104
74: ; preds = %58
%75 = getelementptr inbounds [40 x i8], [40 x i8]* %8, i64 0, i64 0
%76 = load i32, i32* %5
%77 = call i32 @snprintf(i8* %75, i32 40, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i32 %76)
%78 = load i32, i32* %6
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %88
80: ; preds = %74
%81 = getelementptr inbounds [40 x i8], [40 x i8]* %8, i64 0, i64 0
%82 = load i32, i32* @O_WRONLY
%83 = load i32, i32* @O_NONBLOCK
%84 = or i32 %82, %83
%85 = load i32, i32* @O_SYNC
%86 = or i32 %84, %85
%87 = call i32 @open(i8* %81, i32 %86)
store i32 %87, i32* %10
br label %96
88: ; preds = %74
%89 = getelementptr inbounds [40 x i8], [40 x i8]* %8, i64 0, i64 0
%90 = load i32, i32* @O_RDONLY
%91 = load i32, i32* @O_NONBLOCK
%92 = or i32 %90, %91
%93 = load i32, i32* @O_SYNC
%94 = or i32 %92, %93
%95 = call i32 @open(i8* %89, i32 %94)
store i32 %95, i32* %10
br label %96
96: ; preds = %88, %80
%97 = load i32, i32* %10
%98 = icmp slt i32 %97, 0
br i1 %98, label %99, label %102
99: ; preds = %96
%100 = load i32, i32* %5
%101 = call i32 @unexport_sysfs_gpio(i32 %100)
br label %102
102: ; preds = %99, %96
%103 = load i32, i32* %10
store i32 %103, i32* %4
br label %104
104: ; preds = %102, %70, %42, %14
%105 = load i32, i32* %4
ret i32 %105
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [23 x i8] c"/sys/class/gpio/export\00"
@errno = global i64 0
@EBUSY = global i64 0
@stderr = global i32 0
@.str.2 = [28 x i8] c"gpio %d is already exported\00"
@.str.3 = [24 x i8] c"Couldn't export gpio %d\00"
@.str.4 = [12 x i8] c"sysfsgpio: \00"
@.str.5 = [33 x i8] c"/sys/class/gpio/gpio%d/direction\00"
@.str.6 = [5 x i8] c"high\00"
@.str.7 = [4 x i8] c"low\00"
@.str.8 = [3 x i8] c"in\00"
@.str.9 = [35 x i8] c"Couldn't set direction for gpio %d\00"
@.str.10 = [29 x i8] c"/sys/class/gpio/gpio%d/value\00"
@O_WRONLY = global i32 0
@O_NONBLOCK = global i32 0
@O_SYNC = global i32 0
@O_RDONLY = global i32 0
define i32 @setup_sysfs_gpio(i32 %0, i32 %1, i32 %2) {
%4 = alloca [40 x i8]
%5 = alloca [4 x i8]
%6 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%8 = tail call i32 @is_gpio_valid(i32 %0)
%9 = icmp eq i32 %8, 0
br i1 %9, label %56, label %10
10: ; preds = %3
%11 = call i32 @snprintf(i8* %7, i32 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%12 = call i32 @open_write_close(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %28
14: ; preds = %10
%15 = load i64, i64* @errno
%16 = load i64, i64* @EBUSY
%17 = icmp eq i64 %15, %16
%18 = load i32, i32* @stderr
br i1 %17, label %19, label %23
19: ; preds = %14
%20 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %0)
%21 = load i32, i32* @stderr
%22 = call i32 @fputc(i8 signext 10, i32 %21)
br label %28
23: ; preds = %14
%24 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %0)
%25 = load i32, i32* @stderr
%26 = call i32 @fputc(i8 signext 10, i32 %25)
%27 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %56
28: ; preds = %19, %10
%29 = call i32 @snprintf(i8* %6, i32 40, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %0)
%30 = icmp eq i32 %1, 0
%31 = icmp eq i32 %2, 0
%32 = select i1 %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0)
%33 = select i1 %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %32
%34 = call i32 @open_write_close(i8* %6, i8* %33)
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %43
36: ; preds = %28
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0), i32 %0)
%39 = load i32, i32* @stderr
%40 = call i32 @fputc(i8 signext 10, i32 %39)
%41 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%42 = call i32 @unexport_sysfs_gpio(i32 %0)
br label %56
43: ; preds = %28
%44 = call i32 @snprintf(i8* %6, i32 40, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i32 %0)
%45 = load i32, i32* @O_RDONLY
%46 = load i32, i32* @O_WRONLY
%47 = select i1 %30, i32 %45, i32 %46
%48 = load i32, i32* @O_NONBLOCK
%49 = or i32 %48, %47
%50 = load i32, i32* @O_SYNC
%51 = or i32 %49, %50
%52 = call i32 @open(i8* %6, i32 %51)
%53 = icmp slt i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %43
%55 = call i32 @unexport_sysfs_gpio(i32 %0)
br label %56
56: ; preds = %43, %54, %3, %36, %23
%57 = phi i32 [ -2, %36 ], [ -2, %23 ], [ -1, %3 ], [ %52, %54 ], [ %52, %43 ]
ret i32 %57
}