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

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int close(int);
int /*<<< orphan*/ closefrom(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fail(char *);
int open(char *, int /*<<< orphan*/);
int read(int, char *, int);
int main(void) {
  int i, max, fds[10];
  char buf[512];
  for (i = 0; i < 10; i++)
    if ((fds[i] = open("/dev/null", O_RDONLY)) == -1)
      exit(0);
  max = i - 1;
  closefrom(fds[max]);
  if (close(fds[max]) != -1)
    fail("failed to close highest fd");
  for (i = 0; i < max; i++)
    if (read(fds[i], buf, sizeof(buf)) == -1)
      fail("closed descriptors it should not have");
  closefrom(fds[0]);
  for (i = 0; i < 10; i++)
    if (close(fds[i]) != -1)
      fail("failed to close from lowest fd");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11c3 <main+0x63>
mov    0x2e5e(%rip),%rax
mov    (%rax),%esi
lea    0xe6d(%rip),%rdi
call   1070 <open@plt>
movslq -0x8(%rbp),%rcx
mov    %eax,-0x40(%rbp,%rcx,4)
cmp    $0xffffffff,%eax
jne    11b0 <main+0x50>
xor    %edi,%edi
call   1080 <exit@plt>
jmp    11b5 <main+0x55>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1179 <main+0x19>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edi
call   1040 <closefrom@plt>
movslq -0xc(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     11fb <main+0x9b>
lea    0xe14(%rip),%rdi
call   1030 <fail@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    124f <main+0xef>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edi
lea    -0x240(%rbp),%rsi
mov    $0x200,%edx
call   1060 <read@plt>
cmp    $0xffffffff,%eax
jne    123c <main+0xdc>
lea    0xdee(%rip),%rdi
call   1030 <fail@plt>
jmp    1241 <main+0xe1>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1202 <main+0xa2>
mov    -0x40(%rbp),%edi
call   1040 <closefrom@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    129d <main+0x13d>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     128a <main+0x12a>
lea    0xdc6(%rip),%rdi
call   1030 <fail@plt>
jmp    128f <main+0x12f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    125e <main+0xfe>
mov    -0x4(%rbp),%eax
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    0x2e70(%rip),%rbx
mov    (%rbx),%esi
lea    0xe7f(%rip),%rdi
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     14f0 <main+0x390>
mov    %eax,%r13d
mov    (%rbx),%esi
lea    0xe65(%rip),%rdi
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     14f0 <main+0x390>
mov    %eax,%r12d
mov    (%rbx),%esi
lea    0xe4b(%rip),%rdi
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     14f0 <main+0x390>
mov    %eax,%r15d
mov    (%rbx),%esi
lea    0xe31(%rip),%rdi
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     14f0 <main+0x390>
mov    %eax,%r14d
mov    (%rbx),%esi
lea    0xe17(%rip),%rdi
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     14f0 <main+0x390>
mov    %eax,%ebp
mov    (%rbx),%esi
lea    0xdfe(%rip),%rdi
call   1070 <open@plt>
mov    %eax,0xc(%rsp)
cmp    $0xffffffff,%eax
je     14f0 <main+0x390>
mov    (%rbx),%esi
lea    0xde3(%rip),%rdi
call   1070 <open@plt>
mov    %eax,0x8(%rsp)
cmp    $0xffffffff,%eax
je     14f0 <main+0x390>
mov    (%rbx),%esi
lea    0xdc8(%rip),%rdi
call   1070 <open@plt>
mov    %eax,(%rsp)
cmp    $0xffffffff,%eax
je     14f0 <main+0x390>
mov    (%rbx),%esi
lea    0xdae(%rip),%rdi
call   1070 <open@plt>
mov    %eax,0x4(%rsp)
cmp    $0xffffffff,%eax
je     14f0 <main+0x390>
mov    (%rbx),%esi
lea    0xd93(%rip),%rdi
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     14f0 <main+0x390>
mov    %eax,%ebx
mov    %eax,%edi
call   1040 <closefrom@plt>
mov    %ebx,%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     129c <main+0x13c>
lea    0xd73(%rip),%rdi
call   1030 <fail@plt>
lea    0x10(%rsp),%rsi
mov    %r13d,%edi
mov    $0x200,%edx
call   1060 <read@plt>
cmp    $0xffffffff,%eax
jne    12bf <main+0x15f>
lea    0xd6b(%rip),%rdi
call   1030 <fail@plt>
lea    0x10(%rsp),%rsi
mov    %r12d,%edi
mov    $0x200,%edx
call   1060 <read@plt>
cmp    $0xffffffff,%eax
jne    12e2 <main+0x182>
lea    0xd48(%rip),%rdi
call   1030 <fail@plt>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0x200,%edx
call   1060 <read@plt>
cmp    $0xffffffff,%eax
jne    1305 <main+0x1a5>
lea    0xd25(%rip),%rdi
call   1030 <fail@plt>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0x200,%edx
call   1060 <read@plt>
cmp    $0xffffffff,%eax
jne    1328 <main+0x1c8>
lea    0xd02(%rip),%rdi
call   1030 <fail@plt>
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0x200,%edx
call   1060 <read@plt>
cmp    $0xffffffff,%eax
jne    134a <main+0x1ea>
lea    0xce0(%rip),%rdi
call   1030 <fail@plt>
lea    0x10(%rsp),%rsi
mov    0xc(%rsp),%edi
mov    $0x200,%edx
call   1060 <read@plt>
cmp    $0xffffffff,%eax
jne    136e <main+0x20e>
lea    0xcbc(%rip),%rdi
call   1030 <fail@plt>
lea    0x10(%rsp),%rsi
mov    0x8(%rsp),%edi
mov    $0x200,%edx
call   1060 <read@plt>
cmp    $0xffffffff,%eax
jne    1392 <main+0x232>
lea    0xc98(%rip),%rdi
call   1030 <fail@plt>
lea    0x10(%rsp),%rsi
mov    (%rsp),%edi
mov    $0x200,%edx
call   1060 <read@plt>
cmp    $0xffffffff,%eax
jne    13b5 <main+0x255>
lea    0xc75(%rip),%rdi
call   1030 <fail@plt>
lea    0x10(%rsp),%rsi
mov    0x4(%rsp),%edi
mov    $0x200,%edx
call   1060 <read@plt>
cmp    $0xffffffff,%eax
jne    13d9 <main+0x279>
lea    0xc51(%rip),%rdi
call   1030 <fail@plt>
mov    %r13d,%edi
call   1040 <closefrom@plt>
mov    %r13d,%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     13fa <main+0x29a>
lea    0xc56(%rip),%rdi
call   1030 <fail@plt>
mov    %r12d,%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     1413 <main+0x2b3>
lea    0xc3d(%rip),%rdi
call   1030 <fail@plt>
mov    %r15d,%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     142c <main+0x2cc>
lea    0xc24(%rip),%rdi
call   1030 <fail@plt>
mov    %r14d,%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     1445 <main+0x2e5>
lea    0xc0b(%rip),%rdi
call   1030 <fail@plt>
mov    %ebp,%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     145d <main+0x2fd>
lea    0xbf3(%rip),%rdi
call   1030 <fail@plt>
mov    0xc(%rsp),%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     1477 <main+0x317>
lea    0xbd9(%rip),%rdi
call   1030 <fail@plt>
mov    0x8(%rsp),%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     1491 <main+0x331>
lea    0xbbf(%rip),%rdi
call   1030 <fail@plt>
mov    (%rsp),%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     14aa <main+0x34a>
lea    0xba6(%rip),%rdi
call   1030 <fail@plt>
mov    0x4(%rsp),%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     14c4 <main+0x364>
lea    0xb8c(%rip),%rdi
call   1030 <fail@plt>
mov    %ebx,%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     14dc <main+0x37c>
lea    0xb74(%rip),%rdi
call   1030 <fail@plt>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"/dev/null\00"
@O_RDONLY = global i32 0
@.str.1 = [27 x i8] c"failed to close highest fd\00"
@.str.2 = [38 x i8] c"closed descriptors it should not have\00"
@.str.3 = [31 x i8] c"failed to close from lowest fd\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i32]
%5 = alloca [512 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %19, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load i32, i32* @O_RDONLY
%11 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %13
store i32 %11, i32* %14
%15 = icmp eq i32 %11, -1
br i1 %15, label %16, label %18
16: ; preds = %9
%17 = call i32 @exit(i32 0)
unreachable
18: ; preds = %9
br label %19
19: ; preds = %18
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %6
22: ; preds = %6
%23 = load i32, i32* %2
%24 = sub nsw i32 %23, 1
store i32 %24, i32* %3
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = call i32 @closefrom(i32 %28)
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = call i32 @close(i32 %33)
%35 = icmp ne i32 %34, -1
br i1 %35, label %36, label %38
36: ; preds = %22
%37 = call i32 @fail(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %36, %22
store i32 0, i32* %2
br label %39
39: ; preds = %54, %38
%40 = load i32, i32* %2
%41 = load i32, i32* %3
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %57
43: ; preds = %39
%44 = load i32, i32* %2
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%49 = call i32 @read(i32 %47, i8* %48, i32 512)
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %53
51: ; preds = %43
%52 = call i32 @fail(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %53
53: ; preds = %51, %43
br label %54
54: ; preds = %53
%55 = load i32, i32* %2
%56 = add nsw i32 %55, 1
store i32 %56, i32* %2
br label %39
57: ; preds = %39
%58 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%59 = load i32, i32* %58
%60 = call i32 @closefrom(i32 %59)
store i32 0, i32* %2
br label %61
61: ; preds = %74, %57
%62 = load i32, i32* %2
%63 = icmp slt i32 %62, 10
br i1 %63, label %64, label %77
64: ; preds = %61
%65 = load i32, i32* %2
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %66
%68 = load i32, i32* %67
%69 = call i32 @close(i32 %68)
%70 = icmp ne i32 %69, -1
br i1 %70, label %71, label %73
71: ; preds = %64
%72 = call i32 @fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %73
73: ; preds = %71, %64
br label %74
74: ; preds = %73
%75 = load i32, i32* %2
%76 = add nsw i32 %75, 1
store i32 %76, i32* %2
br label %61
77: ; preds = %61
%78 = load i32, i32* %1
ret i32 %78
}

LLVM IR (-O2):
@.str = [10 x i8] c"/dev/null\00"
@O_RDONLY = global i32 0
@.str.1 = [27 x i8] c"failed to close highest fd\00"
@.str.2 = [38 x i8] c"closed descriptors it should not have\00"
@.str.3 = [31 x i8] c"failed to close from lowest fd\00"
define i32 @main() {
%1 = alloca [512 x i8]
%2 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @O_RDONLY
%4 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %40, %36, %32, %28, %24, %20, %16, %12, %8, %0
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %0
%9 = load i32, i32* @O_RDONLY
%10 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %6, label %12
12: ; preds = %8
%13 = load i32, i32* @O_RDONLY
%14 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %6, label %16
16: ; preds = %12
%17 = load i32, i32* @O_RDONLY
%18 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = icmp eq i32 %18, -1
br i1 %19, label %6, label %20
20: ; preds = %16
%21 = load i32, i32* @O_RDONLY
%22 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = icmp eq i32 %22, -1
br i1 %23, label %6, label %24
24: ; preds = %20
%25 = load i32, i32* @O_RDONLY
%26 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = icmp eq i32 %26, -1
br i1 %27, label %6, label %28
28: ; preds = %24
%29 = load i32, i32* @O_RDONLY
%30 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = icmp eq i32 %30, -1
br i1 %31, label %6, label %32
32: ; preds = %28
%33 = load i32, i32* @O_RDONLY
%34 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = icmp eq i32 %34, -1
br i1 %35, label %6, label %36
36: ; preds = %32
%37 = load i32, i32* @O_RDONLY
%38 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = icmp eq i32 %38, -1
br i1 %39, label %6, label %40
40: ; preds = %36
%41 = load i32, i32* @O_RDONLY
%42 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %41)
%43 = icmp eq i32 %42, -1
br i1 %43, label %6, label %44
44: ; preds = %40
%45 = tail call i32 @closefrom(i32 %42)
%46 = tail call i32 @close(i32 %42)
%47 = icmp eq i32 %46, -1
br i1 %47, label %50, label %48
48: ; preds = %44
%49 = tail call i32 @fail(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %50
50: ; preds = %44, %48
%51 = call i32 @read(i32 %4, i8* %2, i32 512)
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = tail call i32 @fail(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %55
55: ; preds = %50, %53
%56 = call i32 @read(i32 %10, i8* %2, i32 512)
%57 = icmp eq i32 %56, -1
br i1 %57, label %58, label %60
58: ; preds = %55
%59 = tail call i32 @fail(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %60
60: ; preds = %58, %55
%61 = call i32 @read(i32 %14, i8* %2, i32 512)
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = tail call i32 @fail(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %65
65: ; preds = %63, %60
%66 = call i32 @read(i32 %18, i8* %2, i32 512)
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %70
68: ; preds = %65
%69 = tail call i32 @fail(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %70
70: ; preds = %68, %65
%71 = call i32 @read(i32 %22, i8* %2, i32 512)
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %75
73: ; preds = %70
%74 = tail call i32 @fail(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %75
75: ; preds = %73, %70
%76 = call i32 @read(i32 %26, i8* %2, i32 512)
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %80
78: ; preds = %75
%79 = tail call i32 @fail(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %80
80: ; preds = %78, %75
%81 = call i32 @read(i32 %30, i8* %2, i32 512)
%82 = icmp eq i32 %81, -1
br i1 %82, label %83, label %85
83: ; preds = %80
%84 = tail call i32 @fail(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %85
85: ; preds = %83, %80
%86 = call i32 @read(i32 %34, i8* %2, i32 512)
%87 = icmp eq i32 %86, -1
br i1 %87, label %88, label %90
88: ; preds = %85
%89 = tail call i32 @fail(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %90
90: ; preds = %88, %85
%91 = call i32 @read(i32 %38, i8* %2, i32 512)
%92 = icmp eq i32 %91, -1
br i1 %92, label %93, label %95
93: ; preds = %90
%94 = tail call i32 @fail(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %95
95: ; preds = %90, %93
%96 = tail call i32 @closefrom(i32 %4)
%97 = tail call i32 @close(i32 %4)
%98 = icmp eq i32 %97, -1
br i1 %98, label %101, label %99
99: ; preds = %95
%100 = tail call i32 @fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %101
101: ; preds = %95, %99
%102 = tail call i32 @close(i32 %10)
%103 = icmp eq i32 %102, -1
br i1 %103, label %106, label %104
104: ; preds = %101
%105 = tail call i32 @fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %106
106: ; preds = %104, %101
%107 = tail call i32 @close(i32 %14)
%108 = icmp eq i32 %107, -1
br i1 %108, label %111, label %109
109: ; preds = %106
%110 = tail call i32 @fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %111
111: ; preds = %109, %106
%112 = tail call i32 @close(i32 %18)
%113 = icmp eq i32 %112, -1
br i1 %113, label %116, label %114
114: ; preds = %111
%115 = tail call i32 @fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %116
116: ; preds = %114, %111
%117 = tail call i32 @close(i32 %22)
%118 = icmp eq i32 %117, -1
br i1 %118, label %121, label %119
119: ; preds = %116
%120 = tail call i32 @fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %121
121: ; preds = %119, %116
%122 = tail call i32 @close(i32 %26)
%123 = icmp eq i32 %122, -1
br i1 %123, label %126, label %124
124: ; preds = %121
%125 = tail call i32 @fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %126
126: ; preds = %124, %121
%127 = tail call i32 @close(i32 %30)
%128 = icmp eq i32 %127, -1
br i1 %128, label %131, label %129
129: ; preds = %126
%130 = tail call i32 @fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %131
131: ; preds = %129, %126
%132 = tail call i32 @close(i32 %34)
%133 = icmp eq i32 %132, -1
br i1 %133, label %136, label %134
134: ; preds = %131
%135 = tail call i32 @fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %136
136: ; preds = %134, %131
%137 = tail call i32 @close(i32 %38)
%138 = icmp eq i32 %137, -1
br i1 %138, label %141, label %139
139: ; preds = %136
%140 = tail call i32 @fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %141
141: ; preds = %139, %136
%142 = tail call i32 @close(i32 %42)
%143 = icmp eq i32 %142, -1
br i1 %143, label %146, label %144
144: ; preds = %141
%145 = tail call i32 @fail(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %146
146: ; preds = %144, %141
ret i32 0
}