#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 ENOENT;
int O_CREAT;
int O_RDONLY;
int O_RDWR;
int /*<<< orphan*/ close(int);
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int open(char *, int);
int /*<<< orphan*/ printf(char *, ...);
char *strerror(int);
int test_open(void) {
  printf("open():\n");
  printf("\tOpen existing file - ");
  int fd = open("/applications/shell", O_RDONLY);
  if (fd != -1) {
    close(fd);
    printf("PASS\n");
  } else {
    printf("FAIL - errno %d (%s)\n", errno, strerror(errno));
  }
  printf("\tOpen nonexistant file - ");
  int fd2 = open("/applications/penis", O_RDONLY);
  if (fd2 == -1 && errno == ENOENT) {
    close(fd2);
    printf("PASS\n");
  } else {
    printf("FAIL - errno %d (%s)\n", errno, strerror(errno));
  }
  printf("\tCreate file - ");
  int fd3 = open("/file-doesnt-exist", O_RDWR | O_CREAT);
  if (fd3 != -1) {
    close(fd3);
    printf("PASS\n");
  } else {
    printf("FAIL - errno %d (%s)\n", errno, strerror(errno));
  }
  printf("\tRecycle descriptors - ");
  int fd4 = open("/applications/bash", O_RDWR);
  close(fd4);
  int fd5 = open("/applications/bash", O_RDWR);
  close(fd5);
  if (fd4 == fd5) {
    printf("PASS\n");
  } else {
    printf("FAIL - %d, %d\n", fd4, fd5);
  }
  int hahaha = open("/applications/bash", O_RDWR);
  if (fork() == 0) {
    close(hahaha);
    int rofl = open("/applications/bash", O_RDWR);
    printf("%d/%d\n", hahaha, rofl);
    close(rofl);
    exit(0);
  }
  close(hahaha);
  printf("Complete\n");
  while (1)
    ;
  return 1;
}


x86 assembly (clang, -O0):
<test_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%esi
lea    0xe8c(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
je     11c1 <test_open+0x61>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ef <test_open+0x8f>
mov    0x2e00(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x20(%rbp),%esi
mov    %rax,%rdx
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%esi
lea    0xe5d(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1252 <test_open+0xf2>
mov    0x2da2(%rip),%rax
mov    (%rax),%eax
mov    0x2d89(%rip),%rcx
cmp    (%rcx),%eax
jne    1252 <test_open+0xf2>
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1280 <test_open+0x120>
mov    0x2d6f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x24(%rbp),%esi
mov    %rax,%rdx
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d4b(%rip),%rax
mov    (%rax),%esi
mov    0x2d5a(%rip),%rax
or     (%rax),%esi
lea    0xde7(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     12d4 <test_open+0x174>
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1302 <test_open+0x1a2>
mov    0x2ced(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2ce1(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x28(%rbp),%esi
mov    %rax,%rdx
lea    0xd3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2cc9(%rip),%rax
mov    (%rax),%esi
lea    0xd99(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <close@plt>
mov    0x2ca9(%rip),%rax
mov    (%rax),%esi
lea    0xd79(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <close@plt>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    136f <test_open+0x20f>
lea    0xcd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1383 <test_open+0x223>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xd50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2c56(%rip),%rax
mov    (%rax),%esi
lea    0xd26(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1080 <fork@plt>
cmp    $0x0,%rax
jne    13ef <test_open+0x28f>
mov    -0x18(%rbp),%edi
call   1040 <close@plt>
mov    0x2c25(%rip),%rax
mov    (%rax),%esi
lea    0xcf5(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xd02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%edi
call   1040 <close@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%edi
call   1040 <close@plt>
lea    0xce4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1405 <test_open+0x2a5>

x86 assembly (clang, -O2):
<test_open>:
push   %rbp
push   %r14
push   %rbx
lea    0xf58(%rip),%rdi
call   1030 <puts@plt>
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e43(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1060 <open@plt>
cmp    $0xffffffff,%eax
je     11be <test_open+0x4e>
mov    %eax,%edi
call   1050 <close@plt>
lea    0xf2d(%rip),%rdi
call   1030 <puts@plt>
jmp    11e1 <test_open+0x71>
mov    0x2e03(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1080 <strerror@plt>
lea    0xe56(%rip),%rdi
mov    %ebx,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe59(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%rbp),%esi
lea    0xe62(%rip),%rdi
call   1060 <open@plt>
mov    0x2dc3(%rip),%rbp
mov    0x0(%rbp),%ebx
cmp    $0xffffffff,%eax
jne    1230 <test_open+0xc0>
mov    0x2da4(%rip),%rax
cmp    (%rax),%ebx
jne    1230 <test_open+0xc0>
mov    $0xffffffff,%edi
call   1050 <close@plt>
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
jmp    124a <test_open+0xda>
mov    %ebx,%edi
call   1080 <strerror@plt>
lea    0xded(%rip),%rdi
mov    %ebx,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2d81(%rip),%r14
mov    0x2d92(%rip),%rax
mov    (%rax),%esi
or     (%r14),%esi
lea    0xe0d(%rip),%rdi
call   1060 <open@plt>
cmp    $0xffffffff,%eax
je     1291 <test_open+0x121>
mov    %eax,%edi
call   1050 <close@plt>
lea    0xe5a(%rip),%rdi
call   1030 <puts@plt>
jmp    12ae <test_open+0x13e>
mov    0x0(%rbp),%ebx
mov    %ebx,%edi
call   1080 <strerror@plt>
lea    0xd89(%rip),%rdi
mov    %ebx,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xddd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r14),%esi
lea    0xde4(%rip),%rbp
mov    %rbp,%rdi
call   1060 <open@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1050 <close@plt>
mov    (%r14),%esi
mov    %rbp,%rdi
call   1060 <open@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1050 <close@plt>
cmp    %ebp,%ebx
jne    12fd <test_open+0x18d>
lea    0xdee(%rip),%rdi
call   1030 <puts@plt>
jmp    130f <test_open+0x19f>
lea    0xdb9(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r14),%esi
lea    0xd91(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1090 <fork@plt>
mov    %rax,%rbp
mov    %ebx,%edi
call   1050 <close@plt>
test   %rbp,%rbp
je     1352 <test_open+0x1e2>
lea    0xd9e(%rip),%rdi
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
jmp    1350 <test_open+0x1e0>
mov    (%r14),%esi
lea    0xd4e(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%ebp
lea    0xd62(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
call   1050 <close@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"open():\0A\00"
@.str.1 = [23 x i8] c"\09Open existing file - \00"
@.str.2 = [20 x i8] c"/applications/shell\00"
@O_RDONLY = global i32 0
@.str.3 = [6 x i8] c"PASS\0A\00"
@.str.4 = [22 x i8] c"FAIL - errno %d (%s)\0A\00"
@errno = global i32 0
@.str.5 = [26 x i8] c"\09Open nonexistant file - \00"
@.str.6 = [20 x i8] c"/applications/penis\00"
@ENOENT = global i32 0
@.str.7 = [16 x i8] c"\09Create file - \00"
@.str.8 = [19 x i8] c"/file-doesnt-exist\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@.str.9 = [24 x i8] c"\09Recycle descriptors - \00"
@.str.10 = [19 x i8] c"/applications/bash\00"
@.str.11 = [15 x i8] c"FAIL - %d, %d\0A\00"
@.str.12 = [7 x i8] c"%d/%d\0A\00"
@.str.13 = [10 x i8] c"Complete\0A\00"
define i32 @test_open() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @O_RDONLY
%11 = call i32 @open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %10)
store i32 %11, i32* %1
%12 = load i32, i32* %1
%13 = icmp ne i32 %12, -1
br i1 %13, label %14, label %18
14: ; preds = %0
%15 = load i32, i32* %1
%16 = call i32 @close(i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %23
18: ; preds = %0
%19 = load i32, i32* @errno
%20 = load i32, i32* @errno
%21 = call i8* @strerror(i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %19, i8* %21)
br label %23
23: ; preds = %18, %14
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%25 = load i32, i32* @O_RDONLY
%26 = call i32 @open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %25)
store i32 %26, i32* %2
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %37
29: ; preds = %23
%30 = load i32, i32* @errno
%31 = load i32, i32* @ENOENT
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load i32, i32* %2
%35 = call i32 @close(i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %42
37: ; preds = %29, %23
%38 = load i32, i32* @errno
%39 = load i32, i32* @errno
%40 = call i8* @strerror(i32 %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %38, i8* %40)
br label %42
42: ; preds = %37, %33
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%44 = load i32, i32* @O_RDWR
%45 = load i32, i32* @O_CREAT
%46 = or i32 %44, %45
%47 = call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %46)
store i32 %47, i32* %3
%48 = load i32, i32* %3
%49 = icmp ne i32 %48, -1
br i1 %49, label %50, label %54
50: ; preds = %42
%51 = load i32, i32* %3
%52 = call i32 @close(i32 %51)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %59
54: ; preds = %42
%55 = load i32, i32* @errno
%56 = load i32, i32* @errno
%57 = call i8* @strerror(i32 %56)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %55, i8* %57)
br label %59
59: ; preds = %54, %50
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%61 = load i32, i32* @O_RDWR
%62 = call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %61)
store i32 %62, i32* %4
%63 = load i32, i32* %4
%64 = call i32 @close(i32 %63)
%65 = load i32, i32* @O_RDWR
%66 = call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %65)
store i32 %66, i32* %5
%67 = load i32, i32* %5
%68 = call i32 @close(i32 %67)
%69 = load i32, i32* %4
%70 = load i32, i32* %5
%71 = icmp eq i32 %69, %70
br i1 %71, label %72, label %74
72: ; preds = %59
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %78
74: ; preds = %59
%75 = load i32, i32* %4
%76 = load i32, i32* %5
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i32 %75, i32 %76)
br label %78
78: ; preds = %74, %72
%79 = load i32, i32* @O_RDWR
%80 = call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %79)
store i32 %80, i32* %6
%81 = call i64 (...) @fork()
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %94
83: ; preds = %78
%84 = load i32, i32* %6
%85 = call i32 @close(i32 %84)
%86 = load i32, i32* @O_RDWR
%87 = call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %86)
store i32 %87, i32* %7
%88 = load i32, i32* %6
%89 = load i32, i32* %7
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %88, i32 %89)
%91 = load i32, i32* %7
%92 = call i32 @close(i32 %91)
%93 = call i32 @exit(i32 0)
unreachable
94: ; preds = %78
%95 = load i32, i32* %6
%96 = call i32 @close(i32 %95)
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
br label %98
98: ; preds = %94, %98
br label %98
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"\09Open existing file - \00"
@.str.2 = [20 x i8] c"/applications/shell\00"
@O_RDONLY = global i32 0
@.str.4 = [22 x i8] c"FAIL - errno %d (%s)\0A\00"
@errno = global i32 0
@.str.5 = [26 x i8] c"\09Open nonexistant file - \00"
@.str.6 = [20 x i8] c"/applications/penis\00"
@ENOENT = global i32 0
@.str.7 = [16 x i8] c"\09Create file - \00"
@.str.8 = [19 x i8] c"/file-doesnt-exist\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@.str.9 = [24 x i8] c"\09Recycle descriptors - \00"
@.str.10 = [19 x i8] c"/applications/bash\00"
@.str.11 = [15 x i8] c"FAIL - %d, %d\0A\00"
@.str.12 = [7 x i8] c"%d/%d\0A\00"
@str = [8 x i8] c"open():\00"
@str.14 = [9 x i8] c"Complete\00"
@str.18 = [5 x i8] c"PASS\00"
define i32 @test_open() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @O_RDONLY
%4 = tail call i32 @open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = tail call i32 @close(i32 %4)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.18, i64 0, i64 0))
br label %13
9: ; preds = %0
%10 = load i32, i32* @errno
%11 = tail call i8* @strerror(i32 %10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %10, i8* %11)
br label %13
13: ; preds = %9, %6
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%15 = load i32, i32* @O_RDONLY
%16 = tail call i32 @open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %15)
%17 = icmp eq i32 %16, -1
%18 = load i32, i32* @errno
%19 = load i32, i32* @ENOENT
%20 = icmp eq i32 %18, %19
%21 = select i1 %17, i1 %20, i1 false
br i1 %21, label %22, label %25
22: ; preds = %13
%23 = tail call i32 @close(i32 -1)
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.18, i64 0, i64 0))
br label %28
25: ; preds = %13
%26 = tail call i8* @strerror(i32 %18)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %18, i8* %26)
br label %28
28: ; preds = %25, %22
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%30 = load i32, i32* @O_RDWR
%31 = load i32, i32* @O_CREAT
%32 = or i32 %31, %30
%33 = tail call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i32 %32)
%34 = icmp eq i32 %33, -1
br i1 %34, label %38, label %35
35: ; preds = %28
%36 = tail call i32 @close(i32 %33)
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.18, i64 0, i64 0))
br label %42
38: ; preds = %28
%39 = load i32, i32* @errno
%40 = tail call i8* @strerror(i32 %39)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %39, i8* %40)
br label %42
42: ; preds = %38, %35
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%44 = load i32, i32* @O_RDWR
%45 = tail call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %44)
%46 = tail call i32 @close(i32 %45)
%47 = load i32, i32* @O_RDWR
%48 = tail call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %47)
%49 = tail call i32 @close(i32 %48)
%50 = icmp eq i32 %45, %48
br i1 %50, label %51, label %53
51: ; preds = %42
%52 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.18, i64 0, i64 0))
br label %55
53: ; preds = %42
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i32 %45, i32 %48)
br label %55
55: ; preds = %53, %51
%56 = load i32, i32* @O_RDWR
%57 = tail call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %56)
%58 = tail call i64 (...) @fork()
%59 = icmp eq i64 %58, 0
%60 = tail call i32 @close(i32 %57)
br i1 %59, label %61, label %67
61: ; preds = %55
%62 = load i32, i32* @O_RDWR
%63 = tail call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %62)
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 %57, i32 %63)
%65 = tail call i32 @close(i32 %63)
%66 = tail call i32 @exit(i32 0)
unreachable
67: ; preds = %55
%68 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.14, i64 0, i64 0))
br label %69
69: ; preds = %69, %67
br label %69
}