#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 uint8_t;
typedef int /*<<< orphan*/ b;

/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
scalar_t__ pwrite(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int strlen(char *);
int /*<<< orphan*/ sysfs_filename(char *, int, int, char *);
int setup(uint8_t pin) {
  int fd;
  char b[64];
  fd = open("/sys/class/gpio/export", O_WRONLY);
  if (fd < 0) {
    perror("/sys/class/gpio/export");
    return 1;
  }
  snprintf(b, sizeof(b), "%d", pin);
  if (pwrite(fd, b, strlen(b), 0) < 0) {
    fprintf(stderr, "Unable to export pin=%d (already in use?): %s\n", pin,
            strerror(errno));
    return 2;
  }
  close(fd);
  sysfs_filename(b, sizeof(b), pin, "edge");
  fd = open(b, O_RDWR);
  if (fd < 0) {
    fprintf(stderr, "Open %s: %s", b, strerror(errno));
    return 3;
  }
  if (pwrite(fd, "both", 4, 0) < 0) {
    fprintf(stderr, "Unable to write 'both' to %s: %s", b, strerror(errno));
    return 4;
  }
  close(fd);
  sysfs_filename(b, sizeof(b), pin, "direction");
  fd = open(b, O_RDWR);
  if (fd < 0) {
    fprintf(stderr, "Open %s: %s", b, strerror(errno));
    return 5;
  }
  if (pwrite(fd, "in", 2, 0) < 0) {
    fprintf(stderr, "Unable to write 'in' to %s: %s", b, strerror(errno));
    return 6;
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0x8(%rbp)
mov    0x2e1b(%rip),%rax
mov    (%rax),%esi
lea    0xe52(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    11d8 <setup+0x48>
lea    0xe39(%rip),%rdi
call   10a0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1467 <setup+0x2d7>
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    $0x40,%esi
lea    0xe2c(%rip),%rdx
call   1050 <snprintf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x5c(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <pwrite@plt>
cmp    $0x0,%rax
jge    1264 <setup+0xd4>
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x64(%rbp),%edi
mov    -0x60(%rbp),%edx
mov    %rax,%rcx
lea    0xdc9(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1467 <setup+0x2d7>
mov    -0xc(%rbp),%edi
call   1060 <close@plt>
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    $0x40,%esi
lea    0xdca(%rip),%rcx
call   1030 <sysfs_filename@plt>
lea    -0x50(%rbp),%rdi
mov    0x2d59(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    12e9 <setup+0x159>
mov    0x2d2e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    0x2d12(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x74(%rbp),%edi
mov    -0x70(%rbp),%rdx
mov    %rax,%rcx
lea    0xd78(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x3,-0x4(%rbp)
jmp    1467 <setup+0x2d7>
mov    -0xc(%rbp),%edi
lea    0xd67(%rip),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1080 <pwrite@plt>
cmp    $0x0,%rax
jge    1355 <setup+0x1c5>
mov    0x2cc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    0x2ca9(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x84(%rbp),%edi
mov    -0x80(%rbp),%rdx
mov    %rax,%rcx
lea    0xd1d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x4,-0x4(%rbp)
jmp    1467 <setup+0x2d7>
mov    -0xc(%rbp),%edi
call   1060 <close@plt>
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    $0x40,%esi
lea    0xd10(%rip),%rcx
call   1030 <sysfs_filename@plt>
lea    -0x50(%rbp),%rdi
mov    0x2c68(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    13e6 <setup+0x256>
mov    0x2c3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    0x2c1b(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x94(%rbp),%edi
mov    -0x90(%rbp),%rdx
mov    %rax,%rcx
lea    0xc7b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x5,-0x4(%rbp)
jmp    1467 <setup+0x2d7>
mov    -0xc(%rbp),%edi
lea    0xc9a(%rip),%rsi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1080 <pwrite@plt>
cmp    $0x0,%rax
jge    1458 <setup+0x2c8>
mov    0x2bcb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa4(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    0x2ba9(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0xa4(%rbp),%edi
mov    -0xa0(%rbp),%rdx
mov    %rax,%rcx
lea    0xc48(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x6,-0x4(%rbp)
jmp    1467 <setup+0x2d7>
mov    -0xc(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %edi,%r14d
mov    0x2e1c(%rip),%rax
mov    (%rax),%esi
lea    0xe53(%rip),%rdi
call   1090 <open@plt>
test   %eax,%eax
js     1388 <setup+0x1f8>
mov    %eax,%ebp
lea    0xe54(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
mov    %r14d,%ecx
call   1050 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <pwrite@plt>
test   %rax,%rax
js     12b7 <setup+0x127>
mov    %ebp,%edi
call   1060 <close@plt>
lea    0xe46(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
mov    %r14d,%edx
call   1030 <sysfs_filename@plt>
mov    0x2dcb(%rip),%r15
mov    (%r15),%esi
mov    %rbx,%rdi
call   1090 <open@plt>
test   %eax,%eax
js     12ee <setup+0x15e>
mov    %eax,%ebx
lea    0xe21(%rip),%rsi
mov    $0x4,%ebp
mov    %eax,%edi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1080 <pwrite@plt>
test   %rax,%rax
js     1325 <setup+0x195>
mov    %ebx,%edi
call   1060 <close@plt>
lea    0xe1d(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
mov    %r14d,%edx
call   1030 <sysfs_filename@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
call   1090 <open@plt>
test   %eax,%eax
js     1354 <setup+0x1c4>
mov    %eax,%ebx
lea    0xdf8(%rip),%rsi
xor    %ebp,%ebp
mov    %eax,%edi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1080 <pwrite@plt>
test   %rax,%rax
js     139b <setup+0x20b>
mov    %ebx,%edi
call   1060 <close@plt>
jmp    13cd <setup+0x23d>
mov    0x2d1a(%rip),%rax
mov    (%rax),%ebx
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xd45(%rip),%rsi
mov    %ebx,%edi
mov    %r14d,%edx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x2,%ebp
jmp    13cd <setup+0x23d>
mov    0x2ce3(%rip),%rax
mov    (%rax),%ebx
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xd42(%rip),%rsi
mov    %rsp,%rdx
mov    %ebx,%edi
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3,%ebp
jmp    13cd <setup+0x23d>
mov    0x2cac(%rip),%rax
mov    (%rax),%ebx
mov    0x2c9b(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xd1c(%rip),%rsi
mov    %rsp,%rdx
mov    %ebx,%edi
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    13cd <setup+0x23d>
mov    0x2c7d(%rip),%rax
mov    (%rax),%ebx
mov    0x2c6c(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xcdc(%rip),%rsi
mov    %rsp,%rdx
mov    %ebx,%edi
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x5,%ebp
jmp    13cd <setup+0x23d>
lea    0xc71(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%ebp
jmp    13cd <setup+0x23d>
mov    0x2c36(%rip),%rax
mov    (%rax),%ebx
mov    0x2c25(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xcd4(%rip),%rsi
mov    %rsp,%rdx
mov    %ebx,%edi
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x6,%ebp
mov    %ebp,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"/sys/class/gpio/export\00"
@O_WRONLY = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.2 = [47 x i8] c"Unable to export pin=%d (already in use?): %s\0A\00"
@errno = global i32 0
@.str.3 = [5 x i8] c"edge\00"
@O_RDWR = global i32 0
@.str.4 = [12 x i8] c"Open %s: %s\00"
@.str.5 = [5 x i8] c"both\00"
@.str.6 = [33 x i8] c"Unable to write 'both' to %s: %s\00"
@.str.7 = [10 x i8] c"direction\00"
@.str.8 = [3 x i8] c"in\00"
@.str.9 = [31 x i8] c"Unable to write 'in' to %s: %s\00"
define i32 @setup(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [64 x i8]
store i32 %0, i32* %3
%6 = load i32, i32* @O_WRONLY
%7 = call i32 @open(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %85
12: ; preds = %1
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%14 = load i32, i32* %3
%15 = call i32 @snprintf(i8* %13, i32 64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %4
%17 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%19 = call i32 @strlen(i8* %18)
%20 = call i64 @pwrite(i32 %16, i8* %17, i32 %19, i32 0)
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %12
%23 = load i32, i32* @stderr
%24 = load i32, i32* %3
%25 = load i32, i32* @errno
%26 = call i8* @strerror(i32 %25)
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32 %24, i8* %26)
store i32 2, i32* %2
br label %85
28: ; preds = %12
%29 = load i32, i32* %4
%30 = call i32 @close(i32 %29)
%31 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%32 = load i32, i32* %3
%33 = call i32 @sysfs_filename(i8* %31, i32 64, i32 %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%34 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%35 = load i32, i32* @O_RDWR
%36 = call i32 @open(i8* %34, i32 %35)
store i32 %36, i32* %4
%37 = load i32, i32* %4
%38 = icmp slt i32 %37, 0
br i1 %38, label %39, label %45
39: ; preds = %28
%40 = load i32, i32* @stderr
%41 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%42 = load i32, i32* @errno
%43 = call i8* @strerror(i32 %42)
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %41, i8* %43)
store i32 3, i32* %2
br label %85
45: ; preds = %28
%46 = load i32, i32* %4
%47 = call i64 @pwrite(i32 %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4, i32 0)
%48 = icmp slt i64 %47, 0
br i1 %48, label %49, label %55
49: ; preds = %45
%50 = load i32, i32* @stderr
%51 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%52 = load i32, i32* @errno
%53 = call i8* @strerror(i32 %52)
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %51, i8* %53)
store i32 4, i32* %2
br label %85
55: ; preds = %45
%56 = load i32, i32* %4
%57 = call i32 @close(i32 %56)
%58 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%59 = load i32, i32* %3
%60 = call i32 @sysfs_filename(i8* %58, i32 64, i32 %59, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%61 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%62 = load i32, i32* @O_RDWR
%63 = call i32 @open(i8* %61, i32 %62)
store i32 %63, i32* %4
%64 = load i32, i32* %4
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %72
66: ; preds = %55
%67 = load i32, i32* @stderr
%68 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%69 = load i32, i32* @errno
%70 = call i8* @strerror(i32 %69)
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %68, i8* %70)
store i32 5, i32* %2
br label %85
72: ; preds = %55
%73 = load i32, i32* %4
%74 = call i64 @pwrite(i32 %73, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 2, i32 0)
%75 = icmp slt i64 %74, 0
br i1 %75, label %76, label %82
76: ; preds = %72
%77 = load i32, i32* @stderr
%78 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%79 = load i32, i32* @errno
%80 = call i8* @strerror(i32 %79)
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* %78, i8* %80)
store i32 6, i32* %2
br label %85
82: ; preds = %72
%83 = load i32, i32* %4
%84 = call i32 @close(i32 %83)
store i32 0, i32* %2
br label %85
85: ; preds = %82, %76, %66, %49, %39, %22, %10
%86 = load i32, i32* %2
ret i32 %86
}

LLVM IR (-O2):
@.str = [23 x i8] c"/sys/class/gpio/export\00"
@O_WRONLY = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.2 = [47 x i8] c"Unable to export pin=%d (already in use?): %s\0A\00"
@errno = global i32 0
@.str.3 = [5 x i8] c"edge\00"
@O_RDWR = global i32 0
@.str.4 = [12 x i8] c"Open %s: %s\00"
@.str.5 = [5 x i8] c"both\00"
@.str.6 = [33 x i8] c"Unable to write 'both' to %s: %s\00"
@.str.7 = [10 x i8] c"direction\00"
@.str.8 = [3 x i8] c"in\00"
@.str.9 = [31 x i8] c"Unable to write 'in' to %s: %s\00"
define i32 @setup(i32 %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @O_WRONLY
%5 = tail call i32 @open(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %59
9: ; preds = %1
%10 = call i32 @snprintf(i8* %3, i32 64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%11 = call i32 @strlen(i8* %3)
%12 = call i64 @pwrite(i32 %5, i8* %3, i32 %11, i32 0)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = load i32, i32* @stderr
%16 = load i32, i32* @errno
%17 = call i8* @strerror(i32 %16)
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32 %0, i8* %17)
br label %59
19: ; preds = %9
%20 = call i32 @close(i32 %5)
%21 = call i32 @sysfs_filename(i8* %3, i32 64, i32 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* @O_RDWR
%23 = call i32 @open(i8* %3, i32 %22)
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %19
%26 = load i32, i32* @stderr
%27 = load i32, i32* @errno
%28 = call i8* @strerror(i32 %27)
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %3, i8* %28)
br label %59
30: ; preds = %19
%31 = call i64 @pwrite(i32 %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 4, i32 0)
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load i32, i32* @stderr
%35 = load i32, i32* @errno
%36 = call i8* @strerror(i32 %35)
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %3, i8* %36)
br label %59
38: ; preds = %30
%39 = call i32 @close(i32 %23)
%40 = call i32 @sysfs_filename(i8* %3, i32 64, i32 %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%41 = load i32, i32* @O_RDWR
%42 = call i32 @open(i8* %3, i32 %41)
%43 = icmp slt i32 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %38
%45 = load i32, i32* @stderr
%46 = load i32, i32* @errno
%47 = call i8* @strerror(i32 %46)
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %3, i8* %47)
br label %59
49: ; preds = %38
%50 = call i64 @pwrite(i32 %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 2, i32 0)
%51 = icmp slt i64 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %49
%53 = load i32, i32* @stderr
%54 = load i32, i32* @errno
%55 = call i8* @strerror(i32 %54)
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* %3, i8* %55)
br label %59
57: ; preds = %49
%58 = call i32 @close(i32 %42)
br label %59
59: ; preds = %57, %52, %44, %33, %25, %14, %7
%60 = phi i32 [ 1, %7 ], [ 2, %14 ], [ 3, %25 ], [ 4, %33 ], [ 5, %44 ], [ 6, %52 ], [ 0, %57 ]
ret i32 %60
}