#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*/ FILE;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  FILE *fgpio;
  char gpio[] = "/sys/class/gpio/gpio00/value";
  char dir[] = "/sys/class/gpio/gpio00/direction";
  int i;
  int port;
  int value;
  int pin_ports[] = {-1, -1, 2,  -1, 3,  -1, 4,  14, -1, 15, 17, 18, 27, -1,
                     22, 23, -1, 24, 10, -1, 9,  25, 11, 8,  -1, 7,  -1, -1,
                     5,  -1, 6,  12, 13, -1, 19, 16, 26, 20, -1, 21};
  if (argc != 3) {
    fprintf(stderr, "usage: %s port value\n", argv[0]);
    printf("9\n");
    return -1;
  }
  port = atoi(argv[1]);
  if (!strcmp(argv[2], "NC"))
    value = -1;
  else if (!strcmp(argv[2], "LOW"))
    value = 0;
  else if (!strcmp(argv[2], "HIGH"))
    value = 1;
  else
    value = atoi(argv[2]);
  for (i = 0; i < 40; i++) {
    if (pin_ports[i] == port) {
      break;
    }
  }
  if (i == 40 || port < 0) {
    fprintf(stderr, "Unsupported Port Error, %d\n", port);
    printf("9\n");
    return -1;
  }
  if (value < -1 || value > 1) {
    fprintf(stderr, "Unsupported Value Error, %d\n", value);
    printf("9\n");
    return -1;
  }
  if (value == -1) {
    fgpio = fopen("/sys/class/gpio/unexport", "w");
    if (fgpio) {
      fprintf(fgpio, "%d\n", port);
      fclose(fgpio);
      printf("-1\n");
      return 0;
    } else {
      fprintf(stderr, "IO Error\n");
      printf("9\n");
      return -1;
    }
  }
  gpio[20] = '\0';
  dir[20] = '\0';
  sprintf(gpio, "%s%d/value", gpio, port);
  sprintf(dir, "%s%d/direction", dir, port);
  fgpio = fopen(gpio, "w");
  if (fgpio == NULL) {
    fgpio = fopen("/sys/class/gpio/export", "w");
    if (fgpio == NULL) {
      fprintf(stderr, "IO Error\n");
      printf("9\n");
      return -1;
    } else {
      fprintf(fgpio, "%d\n", port);
      fclose(fgpio);
      for (i = 0; i < 3; i++) {
        fgpio = fopen(dir, "w");
        if (fgpio)
          break;
        usleep(50000);
      }
      if (i == 3) {
        fprintf(stderr, "IO Error %s\n", dir);
        printf("9\n");
        return -1;
      }
      fprintf(fgpio, "out\n");
      fclose(fgpio);
      fgpio = fopen(gpio, "w");
      if (fgpio == NULL) {
        fprintf(stderr, "IO Error %s\n", gpio);
        printf("9\n");
        return -1;
      }
    }
  }
  fprintf(fgpio, "%d\n", value);
  fclose(fgpio);
  printf("%d\n", value);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe50(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe4d(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe4a(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe48(%rip),%eax
mov    %eax,-0x28(%rbp)
mov    0xe43(%rip),%al
mov    %al,-0x24(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe39(%rip),%rsi
mov    $0x21,%edx
call   1070 <memcpy@plt>
lea    -0x120(%rbp),%rdi
lea    0xe51(%rip),%rsi
mov    $0xa0,%edx
call   1070 <memcpy@plt>
cmpl   $0x3,-0x8(%rbp)
je     124c <main+0xbc>
mov    0x2dc6(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xec5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    165a <main+0x4ca>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x78(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe9e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1285 <main+0xf5>
movl   $0xffffffff,-0x7c(%rbp)
jmp    12f1 <main+0x161>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe78(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12ae <main+0x11e>
movl   $0x0,-0x7c(%rbp)
jmp    12ec <main+0x15c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe53(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12d7 <main+0x147>
movl   $0x1,-0x7c(%rbp)
jmp    12e7 <main+0x157>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x7c(%rbp)
jmp    12ec <main+0x15c>
jmp    12f1 <main+0x161>
movl   $0x0,-0x74(%rbp)
cmpl   $0x28,-0x74(%rbp)
jge    132e <main+0x19e>
movslq -0x74(%rbp),%rax
mov    -0x120(%rbp,%rax,4),%eax
cmp    -0x78(%rbp),%eax
jne    131b <main+0x18b>
jmp    132e <main+0x19e>
jmp    1320 <main+0x190>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    12f8 <main+0x168>
cmpl   $0x28,-0x74(%rbp)
je     1342 <main+0x1b2>
cmpl   $0x0,-0x78(%rbp)
jge    1377 <main+0x1e7>
mov    0x2c97(%rip),%rax
mov    (%rax),%rdi
mov    -0x78(%rbp),%edx
lea    0xdbf(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    165a <main+0x4ca>
cmpl   $0xffffffff,-0x7c(%rbp)
jl     138b <main+0x1fb>
cmpl   $0x1,-0x7c(%rbp)
jle    13c0 <main+0x230>
mov    0x2c4e(%rip),%rax
mov    (%rax),%rdi
mov    -0x7c(%rbp),%edx
lea    0xd92(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    0xd59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    165a <main+0x4ca>
cmpl   $0xffffffff,-0x7c(%rbp)
jne    1456 <main+0x2c6>
lea    0xd7d(%rip),%rdi
lea    0xd8f(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1424 <main+0x294>
mov    -0x18(%rbp),%rdi
mov    -0x78(%rbp),%edx
lea    0xd50(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    165a <main+0x4ca>
mov    0x2bb5(%rip),%rax
mov    (%rax),%rdi
lea    0xd38(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    165a <main+0x4ca>
movb   $0x0,-0x2c(%rbp)
movb   $0x0,-0x5c(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x40(%rbp),%rdx
mov    -0x78(%rbp),%ecx
lea    0xd07(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x70(%rbp),%rdi
lea    -0x70(%rbp),%rdx
mov    -0x78(%rbp),%ecx
lea    0xcfb(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x40(%rbp),%rdi
lea    0xcd0(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1624 <main+0x494>
lea    0xcdf(%rip),%rdi
lea    0xcae(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    14ff <main+0x36f>
mov    0x2b0c(%rip),%rax
mov    (%rax),%rdi
lea    0xc8f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    0xc1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    165a <main+0x4ca>
mov    -0x18(%rbp),%rdi
mov    -0x78(%rbp),%edx
lea    0xc3d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    156a <main+0x3da>
lea    -0x70(%rbp),%rdi
lea    0xc2e(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1552 <main+0x3c2>
jmp    156a <main+0x3da>
mov    $0xc350,%edi
call   10b0 <usleep@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1524 <main+0x394>
cmpl   $0x3,-0x74(%rbp)
jne    15aa <main+0x41a>
mov    0x2a65(%rip),%rax
mov    (%rax),%rdi
lea    -0x70(%rbp),%rdx
lea    0xc1f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    0xb6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    165a <main+0x4ca>
mov    -0x18(%rbp),%rdi
lea    0xc00(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x40(%rbp),%rdi
lea    0xb97(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    161a <main+0x48a>
mov    0x29f5(%rip),%rax
mov    (%rax),%rdi
lea    -0x40(%rbp),%rdx
lea    0xbaf(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    0xaff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    165a <main+0x4ca>
jmp    161f <main+0x48f>
jmp    1624 <main+0x494>
mov    -0x18(%rbp),%rdi
mov    -0x7c(%rbp),%edx
lea    0xb18(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x7c(%rbp),%esi
lea    0xafe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%rbx
movups 0xe59(%rip),%xmm0
movups %xmm0,0x3d(%rsp)
movaps 0xe40(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe64(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe48(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x20(%rsp)
cmp    $0x3,%edi
jne    123b <main+0x9b>
mov    0x8(%rbx),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rbx
lea    0xf0a(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     125b <main+0xbb>
lea    0xefa(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1263 <main+0xc3>
lea    0xeeb(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1268 <main+0xc8>
mov    %rbx,%rdi
call   1090 <atoi@plt>
mov    %eax,%r14d
jmp    126e <main+0xce>
mov    0x2d9e(%rip),%rax
mov    (%rax),%rdi
mov    (%rbx),%rdx
lea    0xea1(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    13b6 <main+0x216>
mov    $0xffffffff,%r14d
jmp    126e <main+0xce>
xor    %r14d,%r14d
jmp    126e <main+0xce>
mov    $0x1,%r14d
mov    $0x4,%eax
lea    0xdd6(%rip),%rcx
nopw   0x0(%rax,%rax,1)
cmp    %ebp,-0x10(%rcx,%rax,4)
je     12b0 <main+0x110>
cmp    %ebp,-0xc(%rcx,%rax,4)
je     12be <main+0x11e>
cmp    %ebp,-0x8(%rcx,%rax,4)
je     12cc <main+0x12c>
cmp    %ebp,-0x4(%rcx,%rax,4)
je     138f <main+0x1ef>
cmp    %ebp,(%rcx,%rax,4)
je     12d0 <main+0x130>
add    $0x5,%rax
cmp    $0x2c,%rax
jne    1280 <main+0xe0>
jmp    139c <main+0x1fc>
add    $0xfffffffffffffffc,%rax
cmp    $0x28,%eax
jne    12d9 <main+0x139>
jmp    139c <main+0x1fc>
add    $0xfffffffffffffffd,%rax
cmp    $0x28,%eax
jne    12d9 <main+0x139>
jmp    139c <main+0x1fc>
add    $0xfffffffffffffffe,%rax
cmp    $0x28,%eax
je     139c <main+0x1fc>
test   %ebp,%ebp
js     139c <main+0x1fc>
lea    -0x2(%r14),%eax
cmp    $0xfffffffc,%eax
ja     1303 <main+0x163>
mov    0x2cef(%rip),%rax
mov    (%rax),%rdi
lea    0xe33(%rip),%rsi
mov    %r14d,%edx
jmp    13af <main+0x20f>
cmp    $0xffffffff,%r14d
je     13d4 <main+0x234>
movb   $0x0,0x44(%rsp)
movb   $0x0,0x14(%rsp)
lea    0xe52(%rip),%rsi
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbx,%rdx
mov    %ebp,%ecx
call   10a0 <sprintf@plt>
lea    0xe44(%rip),%rsi
mov    %rsp,%rdi
mov    %rdi,%rdx
mov    %ebp,%ecx
call   10a0 <sprintf@plt>
lea    0xe19(%rip),%rsi
mov    %rbx,%rdi
call   1080 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
je     141e <main+0x27e>
lea    0xde1(%rip),%rbp
xor    %ebx,%ebx
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    13c7 <main+0x227>
add    $0xffffffffffffffff,%rax
cmp    $0x28,%eax
jne    12d9 <main+0x139>
mov    0x2c3d(%rip),%rax
mov    (%rax),%rdi
lea    0xd65(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0xdf9(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd70(%rip),%rdi
lea    0xd82(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     150a <main+0x36a>
mov    %rax,%r14
lea    0xd4d(%rip),%rsi
xor    %ebx,%ebx
mov    %rax,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
lea    0xd9c(%rip),%rdi
call   1030 <puts@plt>
jmp    13c7 <main+0x227>
lea    0xd65(%rip),%rdi
lea    0xd38(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     150a <main+0x36a>
mov    %rax,%rbx
lea    0xd03(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xd05(%rip),%rsi
mov    %rsp,%rdi
call   1080 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    14b1 <main+0x311>
mov    $0xc350,%edi
call   10c0 <usleep@plt>
lea    0xce4(%rip),%rsi
mov    %rsp,%rdi
call   1080 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    14b1 <main+0x311>
mov    $0xc350,%edi
call   10c0 <usleep@plt>
lea    0xcc3(%rip),%rsi
mov    %rsp,%rdi
call   1080 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     152f <main+0x38f>
lea    0xcf6(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10b0 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xc8b(%rip),%rsi
lea    0x30(%rsp),%rdi
call   1080 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
jne    135f <main+0x1bf>
mov    0x2aea(%rip),%rax
mov    (%rax),%rdi
lea    0xca1(%rip),%rsi
lea    0x30(%rsp),%rdx
jmp    124f <main+0xaf>
mov    0x2acf(%rip),%rax
mov    (%rax),%rcx
lea    0xc4b(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
jmp    13b6 <main+0x216>
mov    $0xc350,%edi
call   10c0 <usleep@plt>
mov    0x2aa0(%rip),%rax
mov    (%rax),%rdi
lea    0xc57(%rip),%rsi
mov    %rsp,%rdx
jmp    124f <main+0xaf>

LLVM IR (-O0):
@__const.main.gpio = [29 x i8] c"/sys/class/gpio/gpio00/value\00"
@__const.main.dir = [33 x i8] c"/sys/class/gpio/gpio00/direction\00"
@__const.main.pin_ports = [40 x i32] [i32 -1, i32 -1, i32 2, i32 -1, i32 3, i32 -1, i32 4, i32 14, i32 -1, i32 15, i32 17, i32 18, i32 27, i32 -1, i32 22, i32 23, i32 -1, i32 24, i32 10, i32 -1, i32 9, i32 25, i32 11, i32 8, i32 -1, i32 7, i32 -1, i32 -1, i32 5, i32 -1, i32 6, i32 12, i32 13, i32 -1, i32 19, i32 16, i32 26, i32 20, i32 -1, i32 21]
@stderr = global i32* null
@.str = [22 x i8] c"usage: %s port value\0A\00"
@.str.1 = [3 x i8] c"9\0A\00"
@.str.2 = [3 x i8] c"NC\00"
@.str.3 = [4 x i8] c"LOW\00"
@.str.4 = [5 x i8] c"HIGH\00"
@.str.5 = [28 x i8] c"Unsupported Port Error, %d\0A\00"
@.str.6 = [29 x i8] c"Unsupported Value Error, %d\0A\00"
@.str.7 = [25 x i8] c"/sys/class/gpio/unexport\00"
@.str.8 = [2 x i8] c"w\00"
@.str.9 = [4 x i8] c"%d\0A\00"
@.str.10 = [4 x i8] c"-1\0A\00"
@.str.11 = [10 x i8] c"IO Error\0A\00"
@.str.12 = [11 x i8] c"%s%d/value\00"
@.str.13 = [15 x i8] c"%s%d/direction\00"
@.str.14 = [23 x i8] c"/sys/class/gpio/export\00"
@.str.15 = [13 x i8] c"IO Error %s\0A\00"
@.str.16 = [5 x i8] c"out\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [29 x i8]
%8 = alloca [33 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [40 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [29 x i8]* %7 to i8*
%14 = bitcast [33 x i8]* %8 to i8*
%15 = bitcast [40 x i32]* %12 to i8*
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 3
br i1 %17, label %18, label %25
18: ; preds = %2
%19 = load i32*, i32** @stderr
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %188
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @atoi(i8* %28)
store i32 %29, i32* %10
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %36, label %35
35: ; preds = %25
store i32 -1, i32* %11
br label %57
36: ; preds = %25
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
%40 = call i32 @strcmp(i8* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%41 = icmp ne i32 %40, 0
br i1 %41, label %43, label %42
42: ; preds = %36
store i32 0, i32* %11
br label %56
43: ; preds = %36
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 2
%46 = load i8*, i8** %45
%47 = call i32 @strcmp(i8* %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%48 = icmp ne i32 %47, 0
br i1 %48, label %50, label %49
49: ; preds = %43
store i32 1, i32* %11
br label %55
50: ; preds = %43
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 2
%53 = load i8*, i8** %52
%54 = call i32 @atoi(i8* %53)
store i32 %54, i32* %11
br label %55
55: ; preds = %50, %49
br label %56
56: ; preds = %55, %42
br label %57
57: ; preds = %56, %35
store i32 0, i32* %9
br label %58
58: ; preds = %70, %57
%59 = load i32, i32* %9
%60 = icmp slt i32 %59, 40
br i1 %60, label %61, label %73
61: ; preds = %58
%62 = load i32, i32* %9
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [40 x i32], [40 x i32]* %12, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = load i32, i32* %10
%67 = icmp eq i32 %65, %66
br i1 %67, label %68, label %69
68: ; preds = %61
br label %73
69: ; preds = %61
br label %70
70: ; preds = %69
%71 = load i32, i32* %9
%72 = add nsw i32 %71, 1
store i32 %72, i32* %9
br label %58
73: ; preds = %68, %58
%74 = load i32, i32* %9
%75 = icmp eq i32 %74, 40
br i1 %75, label %79, label %76
76: ; preds = %73
%77 = load i32, i32* %10
%78 = icmp slt i32 %77, 0
br i1 %78, label %79, label %84
79: ; preds = %76, %73
%80 = load i32*, i32** @stderr
%81 = load i32, i32* %10
%82 = call i32 (i32*, i8*, ...) @fprintf(i32* %80, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %81)
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %188
84: ; preds = %76
%85 = load i32, i32* %11
%86 = icmp slt i32 %85, -1
br i1 %86, label %90, label %87
87: ; preds = %84
%88 = load i32, i32* %11
%89 = icmp sgt i32 %88, 1
br i1 %89, label %90, label %95
90: ; preds = %87, %84
%91 = load i32*, i32** @stderr
%92 = load i32, i32* %11
%93 = call i32 (i32*, i8*, ...) @fprintf(i32* %91, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %92)
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %188
95: ; preds = %87
%96 = load i32, i32* %11
%97 = icmp eq i32 %96, -1
br i1 %97, label %98, label %113
98: ; preds = %95
%99 = call i32* @fopen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %99, i32** %6
%100 = load i32*, i32** %6
%101 = icmp ne i32* %100, null
br i1 %101, label %102, label %109
102: ; preds = %98
%103 = load i32*, i32** %6
%104 = load i32, i32* %10
%105 = call i32 (i32*, i8*, ...) @fprintf(i32* %103, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %104)
%106 = load i32*, i32** %6
%107 = call i32 @fclose(i32* %106)
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %3
br label %188
109: ; preds = %98
%110 = load i32*, i32** @stderr
%111 = call i32 (i32*, i8*, ...) @fprintf(i32* %110, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %188
113: ; preds = %95
%114 = getelementptr inbounds [29 x i8], [29 x i8]* %7, i64 0, i64 20
store i8 0, i8* %114
%115 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 20
store i8 0, i8* %115
%116 = getelementptr inbounds [29 x i8], [29 x i8]* %7, i64 0, i64 0
%117 = getelementptr inbounds [29 x i8], [29 x i8]* %7, i64 0, i64 0
%118 = load i32, i32* %10
%119 = call i32 @sprintf(i8* %116, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %117, i32 %118)
%120 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%121 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%122 = load i32, i32* %10
%123 = call i32 @sprintf(i8* %120, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0), i8* %121, i32 %122)
%124 = getelementptr inbounds [29 x i8], [29 x i8]* %7, i64 0, i64 0
%125 = call i32* @fopen(i8* %124, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %125, i32** %6
%126 = load i32*, i32** %6
%127 = icmp eq i32* %126, null
br i1 %127, label %128, label %180
128: ; preds = %113
%129 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %129, i32** %6
%130 = load i32*, i32** %6
%131 = icmp eq i32* %130, null
br i1 %131, label %132, label %136
132: ; preds = %128
%133 = load i32*, i32** @stderr
%134 = call i32 (i32*, i8*, ...) @fprintf(i32* %133, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %188
136: ; preds = %128
%137 = load i32*, i32** %6
%138 = load i32, i32* %10
%139 = call i32 (i32*, i8*, ...) @fprintf(i32* %137, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %138)
%140 = load i32*, i32** %6
%141 = call i32 @fclose(i32* %140)
store i32 0, i32* %9
br label %142
142: ; preds = %153, %136
%143 = load i32, i32* %9
%144 = icmp slt i32 %143, 3
br i1 %144, label %145, label %156
145: ; preds = %142
%146 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%147 = call i32* @fopen(i8* %146, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %147, i32** %6
%148 = load i32*, i32** %6
%149 = icmp ne i32* %148, null
br i1 %149, label %150, label %151
150: ; preds = %145
br label %156
151: ; preds = %145
%152 = call i32 @usleep(i32 50000)
br label %153
153: ; preds = %151
%154 = load i32, i32* %9
%155 = add nsw i32 %154, 1
store i32 %155, i32* %9
br label %142
156: ; preds = %150, %142
%157 = load i32, i32* %9
%158 = icmp eq i32 %157, 3
br i1 %158, label %159, label %164
159: ; preds = %156
%160 = load i32*, i32** @stderr
%161 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%162 = call i32 (i32*, i8*, ...) @fprintf(i32* %160, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), i8* %161)
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %188
164: ; preds = %156
%165 = load i32*, i32** %6
%166 = call i32 (i32*, i8*, ...) @fprintf(i32* %165, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0))
%167 = load i32*, i32** %6
%168 = call i32 @fclose(i32* %167)
%169 = getelementptr inbounds [29 x i8], [29 x i8]* %7, i64 0, i64 0
%170 = call i32* @fopen(i8* %169, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %170, i32** %6
%171 = load i32*, i32** %6
%172 = icmp eq i32* %171, null
br i1 %172, label %173, label %178
173: ; preds = %164
%174 = load i32*, i32** @stderr
%175 = getelementptr inbounds [29 x i8], [29 x i8]* %7, i64 0, i64 0
%176 = call i32 (i32*, i8*, ...) @fprintf(i32* %174, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), i8* %175)
%177 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %188
178: ; preds = %164
br label %179
179: ; preds = %178
br label %180
180: ; preds = %179, %113
%181 = load i32*, i32** %6
%182 = load i32, i32* %11
%183 = call i32 (i32*, i8*, ...) @fprintf(i32* %181, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %182)
%184 = load i32*, i32** %6
%185 = call i32 @fclose(i32* %184)
%186 = load i32, i32* %11
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %186)
store i32 0, i32* %3
br label %188
188: ; preds = %180, %173, %159, %132, %109, %102, %90, %79, %18
%189 = load i32, i32* %3
ret i32 %189
}

LLVM IR (-O2):
@__const.main.gpio = [29 x i8] c"/sys/class/gpio/gpio00/value\00"
@__const.main.dir = [33 x i8] c"/sys/class/gpio/gpio00/direction\00"
@__const.main.pin_ports = [40 x i32] [i32 -1, i32 -1, i32 2, i32 -1, i32 3, i32 -1, i32 4, i32 14, i32 -1, i32 15, i32 17, i32 18, i32 27, i32 -1, i32 22, i32 23, i32 -1, i32 24, i32 10, i32 -1, i32 9, i32 25, i32 11, i32 8, i32 -1, i32 7, i32 -1, i32 -1, i32 5, i32 -1, i32 6, i32 12, i32 13, i32 -1, i32 19, i32 16, i32 26, i32 20, i32 -1, i32 21]
@stderr = global i32* null
@.str = [22 x i8] c"usage: %s port value\0A\00"
@.str.2 = [3 x i8] c"NC\00"
@.str.3 = [4 x i8] c"LOW\00"
@.str.4 = [5 x i8] c"HIGH\00"
@.str.5 = [28 x i8] c"Unsupported Port Error, %d\0A\00"
@.str.6 = [29 x i8] c"Unsupported Value Error, %d\0A\00"
@.str.7 = [25 x i8] c"/sys/class/gpio/unexport\00"
@.str.8 = [2 x i8] c"w\00"
@.str.9 = [4 x i8] c"%d\0A\00"
@.str.11 = [10 x i8] c"IO Error\0A\00"
@.str.12 = [11 x i8] c"%s%d/value\00"
@.str.13 = [15 x i8] c"%s%d/direction\00"
@.str.14 = [23 x i8] c"/sys/class/gpio/export\00"
@.str.15 = [13 x i8] c"IO Error %s\0A\00"
@.str.16 = [5 x i8] c"out\0A\00"
@str.20 = [3 x i8] c"-1\00"
@str.23 = [2 x i8] c"9\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [29 x i8]
%4 = alloca [33 x i8]
%5 = getelementptr inbounds [29 x i8], [29 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 3
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = load i32*, i32** @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.23, i64 0, i64 0))
br label %136
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i32 @strcmp(i8* dereferenceable(1) %18, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %29, label %21
21: ; preds = %13
%22 = tail call i32 @strcmp(i8* dereferenceable(1) %18, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i32 %22, 0
br i1 %23, label %29, label %24
24: ; preds = %21
%25 = tail call i32 @strcmp(i8* dereferenceable(1) %18, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %24
%28 = tail call i32 @atoi(i8* %18)
br label %29
29: ; preds = %24, %21, %13, %27
%30 = phi i32 [ %28, %27 ], [ -1, %13 ], [ 0, %21 ], [ 1, %24 ]
br label %31
31: ; preds = %56, %29
%32 = phi i64 [ 0, %29 ], [ %57, %56 ]
%33 = getelementptr inbounds [40 x i32], [40 x i32]* @__const.main.pin_ports, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, %16
br i1 %35, label %59, label %36
36: ; preds = %31
%37 = add nuw nsw i64 %32, 1
%38 = getelementptr inbounds [40 x i32], [40 x i32]* @__const.main.pin_ports, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = icmp eq i32 %39, %16
br i1 %40, label %59, label %41
41: ; preds = %36
%42 = add nuw nsw i64 %32, 2
%43 = getelementptr inbounds [40 x i32], [40 x i32]* @__const.main.pin_ports, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, %16
br i1 %45, label %59, label %46
46: ; preds = %41
%47 = add nuw nsw i64 %32, 3
%48 = getelementptr inbounds [40 x i32], [40 x i32]* @__const.main.pin_ports, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = icmp eq i32 %49, %16
br i1 %50, label %59, label %51
51: ; preds = %46
%52 = add nuw nsw i64 %32, 4
%53 = getelementptr inbounds [40 x i32], [40 x i32]* @__const.main.pin_ports, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = icmp eq i32 %54, %16
br i1 %55, label %59, label %56
56: ; preds = %51
%57 = add nuw nsw i64 %32, 5
%58 = icmp eq i64 %57, 40
br i1 %58, label %65, label %31
59: ; preds = %51, %46, %41, %36, %31
%60 = phi i64 [ %32, %31 ], [ %37, %36 ], [ %42, %41 ], [ %47, %46 ], [ %52, %51 ]
%61 = trunc i64 %60 to i32
%62 = icmp eq i32 %61, 40
%63 = icmp slt i32 %16, 0
%64 = select i1 %62, i1 true, i1 %63
br i1 %64, label %65, label %69
65: ; preds = %56, %59
%66 = load i32*, i32** @stderr
%67 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %66, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %16)
%68 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.23, i64 0, i64 0))
br label %136
69: ; preds = %59
%70 = add i32 %30, -2
%71 = icmp ult i32 %70, -3
br i1 %71, label %72, label %76
72: ; preds = %69
%73 = load i32*, i32** @stderr
%74 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %73, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %30)
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.23, i64 0, i64 0))
br label %136
76: ; preds = %69
%77 = icmp eq i32 %30, -1
br i1 %77, label %78, label %89
78: ; preds = %76
%79 = tail call i32* @fopen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%80 = icmp eq i32* %79, null
br i1 %80, label %85, label %81
81: ; preds = %78
%82 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %79, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %16)
%83 = tail call i32 @fclose(i32* %79)
%84 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.20, i64 0, i64 0))
br label %136
85: ; preds = %78
%86 = load i32*, i32** @stderr
%87 = tail call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i64 9, i64 1, i32* %86)
%88 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.23, i64 0, i64 0))
br label %136
89: ; preds = %76
%90 = getelementptr inbounds [29 x i8], [29 x i8]* %3, i64 0, i64 20
store i8 0, i8* %90
%91 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 20
store i8 0, i8* %91
%92 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %5, i32 %16)
%93 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0), i8* %6, i32 %16)
%94 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%95 = icmp eq i32* %94, null
br i1 %95, label %96, label %131
96: ; preds = %89
%97 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%98 = icmp eq i32* %97, null
br i1 %98, label %99, label %103
99: ; preds = %96
%100 = load i32*, i32** @stderr
%101 = call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0), i64 9, i64 1, i32* %100)
%102 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.23, i64 0, i64 0))
br label %136
103: ; preds = %96
%104 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %16)
%105 = call i32 @fclose(i32* %97)
%106 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%107 = icmp eq i32* %106, null
br i1 %107, label %108, label %121
108: ; preds = %103
%109 = call i32 @usleep(i32 50000)
%110 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%111 = icmp eq i32* %110, null
br i1 %111, label %112, label %121
112: ; preds = %108
%113 = call i32 @usleep(i32 50000)
%114 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%115 = icmp eq i32* %114, null
br i1 %115, label %116, label %121
116: ; preds = %112
%117 = call i32 @usleep(i32 50000)
%118 = load i32*, i32** @stderr
%119 = call i32 (i32*, i8*, ...) @fprintf(i32* %118, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), i8* %6)
%120 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.23, i64 0, i64 0))
br label %136
121: ; preds = %103, %108, %112
%122 = phi i32* [ %106, %103 ], [ %110, %108 ], [ %114, %112 ]
%123 = call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0), i64 4, i64 1, i32* %122)
%124 = call i32 @fclose(i32* %122)
%125 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%126 = icmp eq i32* %125, null
br i1 %126, label %127, label %131
127: ; preds = %121
%128 = load i32*, i32** @stderr
%129 = call i32 (i32*, i8*, ...) @fprintf(i32* %128, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0), i8* %5)
%130 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.23, i64 0, i64 0))
br label %136
131: ; preds = %121, %89
%132 = phi i32* [ %125, %121 ], [ %94, %89 ]
%133 = call i32 (i32*, i8*, ...) @fprintf(i32* %132, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %30)
%134 = call i32 @fclose(i32* %132)
%135 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %30)
br label %136
136: ; preds = %131, %127, %116, %99, %85, %81, %72, %65, %8
%137 = phi i32 [ -1, %8 ], [ -1, %65 ], [ -1, %72 ], [ 0, %81 ], [ -1, %85 ], [ -1, %99 ], [ -1, %116 ], [ -1, %127 ], [ 0, %131 ]
ret i32 %137
}