#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 L_tmpnam;
int /*<<< orphan*/ fail(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/);
int /*<<< orphan*/ fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ pr(char *);
int /*<<< orphan*/ remove(char *);
scalar_t__ rename(char *, char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ *tmpfile();
int /*<<< orphan*/ *tmpnam(char *);
void test_file(void) {
  FILE *f;
  char buf[1024];
  char tn1[L_tmpnam], tn2[L_tmpnam];
  fclose(fopen("stdio.tmp", "w"));
  pr("remove");
  if (remove("stdio.tmp") < 0)
    fail("remove-1");
  if (remove("stdio.tmp") >= 0)
    fail("remove-2");
  pr("rename");
  if (rename("stdio.tmp", "stdio2.tmp") >= 0)
    fail("rename-1");
  fclose(fopen("stdio.tmp", "w"));
  if (rename("stdio.tmp", "stdio2.tmp") < 0)
    fail("rename-2");
  if (rename("stdio.tmp", "stdio2.tmp") >= 0)
    fail("rename-3");
  remove("stdio2.tmp");
  pr("tmpfile");
  if ((f = tmpfile()) == NULL)
    fail("tmpfile-1");
  memset(buf, 0xa5, 1024);
  if (fwrite(buf, 1, 1024, f) != 1024)
    fail("tmpfile-2");
  rewind(f);
  if (fread(buf, 1, 1024, f) != 1024)
    fail("tmpfile-3");
  pr("tmpnam");
  if (tmpnam(tn1) == NULL)
    fail("tmpnam-1");
  fclose(fopen(tn1, "w"));
  if (tmpnam(tn2) == NULL)
    fail("tmpnam-2");
  if (!strcmp(tn1, tn2))
    fail("tmpnam-3");
  remove(tn1);
}


x86 assembly (clang, -O0):
<test_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    0x2dfe(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x418(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x438(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x420(%rbp)
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x430(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x428(%rbp)
lea    0xdc5(%rip),%rdi
lea    0xdc8(%rip),%rsi
call   10c0 <fopen@plt>
mov    %eax,%edi
call   1060 <fclose@plt>
lea    0xdb7(%rip),%rdi
call   1080 <pr@plt>
lea    0xd9f(%rip),%rdi
call   1030 <remove@plt>
cmp    $0x0,%eax
jge    127b <test_file+0xab>
lea    0xd9d(%rip),%rdi
call   1050 <fail@plt>
lea    0xd7e(%rip),%rdi
call   1030 <remove@plt>
cmp    $0x0,%eax
jl     129c <test_file+0xcc>
lea    0xd85(%rip),%rdi
call   1050 <fail@plt>
lea    0xd82(%rip),%rdi
call   1080 <pr@plt>
lea    0xd51(%rip),%rdi
lea    0xd76(%rip),%rsi
call   10d0 <rename@plt>
cmp    $0x0,%rax
jl     12d1 <test_file+0x101>
lea    0xd6b(%rip),%rdi
call   1050 <fail@plt>
lea    0xd28(%rip),%rdi
lea    0xd2b(%rip),%rsi
call   10c0 <fopen@plt>
mov    %eax,%edi
call   1060 <fclose@plt>
lea    0xd0e(%rip),%rdi
lea    0xd33(%rip),%rsi
call   10d0 <rename@plt>
cmp    $0x0,%rax
jge    1314 <test_file+0x144>
lea    0xd31(%rip),%rdi
call   1050 <fail@plt>
lea    0xce5(%rip),%rdi
lea    0xd0a(%rip),%rsi
call   10d0 <rename@plt>
cmp    $0x0,%rax
jl     133d <test_file+0x16d>
lea    0xd11(%rip),%rdi
call   1050 <fail@plt>
lea    0xce8(%rip),%rdi
call   1030 <remove@plt>
lea    0xd02(%rip),%rdi
call   1080 <pr@plt>
mov    $0x0,%al
call   10a0 <tmpfile@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    1376 <test_file+0x1a6>
lea    0xce9(%rip),%rdi
call   1050 <fail@plt>
lea    -0x410(%rbp),%rdi
mov    $0xa5,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   10e0 <fwrite@plt>
cmp    $0x400,%eax
je     13bd <test_file+0x1ed>
lea    0xcac(%rip),%rdi
call   1050 <fail@plt>
mov    -0x8(%rbp),%rdi
call   1070 <rewind@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1040 <fread@plt>
cmp    $0x400,%eax
je     13f7 <test_file+0x227>
lea    0xc7c(%rip),%rdi
call   1050 <fail@plt>
lea    0xc7a(%rip),%rdi
call   1080 <pr@plt>
mov    -0x438(%rbp),%rdi
call   10f0 <tmpnam@plt>
cmp    $0x0,%rax
jne    1425 <test_file+0x255>
lea    0xc5f(%rip),%rdi
call   1050 <fail@plt>
mov    -0x438(%rbp),%rdi
lea    0xbd7(%rip),%rsi
call   10c0 <fopen@plt>
mov    %eax,%edi
call   1060 <fclose@plt>
mov    -0x430(%rbp),%rdi
call   10f0 <tmpnam@plt>
cmp    $0x0,%rax
jne    1461 <test_file+0x291>
lea    0xc2c(%rip),%rdi
call   1050 <fail@plt>
mov    -0x430(%rbp),%rsi
mov    -0x438(%rbp),%rdi
call   10b0 <strcmp@plt>
cmp    $0x0,%eax
jne    1489 <test_file+0x2b9>
lea    0xc0d(%rip),%rdi
call   1050 <fail@plt>
mov    -0x438(%rbp),%rdi
call   1030 <remove@plt>
mov    -0x418(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_file>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rsp,%r13
mov    0x2df2(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%r15
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r15
mov    %r15,%rsp
mov    (%rax),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    0xde5(%rip),%rbx
lea    0xde8(%rip),%rsi
mov    %rbx,%rdi
call   10c0 <fopen@plt>
mov    %eax,%edi
call   1060 <fclose@plt>
lea    0xdd4(%rip),%rdi
call   1080 <pr@plt>
mov    %rbx,%rdi
call   1030 <remove@plt>
test   %eax,%eax
jns    1255 <test_file+0x85>
lea    0xdc3(%rip),%rdi
call   1050 <fail@plt>
lea    0xda4(%rip),%rdi
call   1030 <remove@plt>
test   %eax,%eax
js     1271 <test_file+0xa1>
lea    0xdb0(%rip),%rdi
call   1050 <fail@plt>
lea    0xdad(%rip),%rdi
call   1080 <pr@plt>
lea    0xd7c(%rip),%rdi
lea    0xda1(%rip),%rsi
call   10d0 <rename@plt>
test   %rax,%rax
js     12a1 <test_file+0xd1>
lea    0xd9b(%rip),%rdi
call   1050 <fail@plt>
lea    0xd58(%rip),%rbx
lea    0xd5b(%rip),%rsi
mov    %rbx,%rdi
call   10c0 <fopen@plt>
mov    %eax,%edi
call   1060 <fclose@plt>
lea    0xd67(%rip),%rsi
mov    %rbx,%rdi
call   10d0 <rename@plt>
test   %rax,%rax
jns    12de <test_file+0x10e>
lea    0xd67(%rip),%rdi
call   1050 <fail@plt>
lea    0xd1b(%rip),%rdi
lea    0xd40(%rip),%rsi
call   10d0 <rename@plt>
test   %rax,%rax
js     1302 <test_file+0x132>
lea    0xd4c(%rip),%rdi
call   1050 <fail@plt>
lea    0xd23(%rip),%rdi
call   1030 <remove@plt>
lea    0xd3d(%rip),%rdi
call   1080 <pr@plt>
xor    %eax,%eax
call   10a0 <tmpfile@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1335 <test_file+0x165>
lea    0xd2a(%rip),%rdi
call   1050 <fail@plt>
lea    -0x430(%rbp),%r12
mov    %r12,%rdi
mov    $0xa5,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %rbx,%rcx
call   10e0 <fwrite@plt>
cmp    $0x400,%eax
je     1376 <test_file+0x1a6>
lea    0xcf3(%rip),%rdi
call   1050 <fail@plt>
mov    %rbx,%rdi
call   1070 <rewind@plt>
lea    -0x430(%rbp),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
je     13aa <test_file+0x1da>
lea    0xcc9(%rip),%rdi
call   1050 <fail@plt>
lea    0xcc7(%rip),%rdi
call   1080 <pr@plt>
mov    %r15,%rdi
call   10f0 <tmpnam@plt>
test   %rax,%rax
jne    13cf <test_file+0x1ff>
lea    0xcb5(%rip),%rdi
call   1050 <fail@plt>
lea    0xc34(%rip),%rsi
mov    %r15,%rdi
call   10c0 <fopen@plt>
mov    %eax,%edi
call   1060 <fclose@plt>
mov    %r14,%rdi
call   10f0 <tmpnam@plt>
test   %rax,%rax
jne    13fe <test_file+0x22e>
lea    0xc8f(%rip),%rdi
call   1050 <fail@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   10b0 <strcmp@plt>
test   %eax,%eax
jne    1419 <test_file+0x249>
lea    0xc7d(%rip),%rdi
call   1050 <fail@plt>
mov    %r15,%rdi
call   1030 <remove@plt>
mov    %r13,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@L_tmpnam = global i32 0
@.str = [10 x i8] c"stdio.tmp\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [7 x i8] c"remove\00"
@.str.3 = [9 x i8] c"remove-1\00"
@.str.4 = [9 x i8] c"remove-2\00"
@.str.5 = [7 x i8] c"rename\00"
@.str.6 = [11 x i8] c"stdio2.tmp\00"
@.str.7 = [9 x i8] c"rename-1\00"
@.str.8 = [9 x i8] c"rename-2\00"
@.str.9 = [9 x i8] c"rename-3\00"
@.str.10 = [8 x i8] c"tmpfile\00"
@.str.11 = [10 x i8] c"tmpfile-1\00"
@.str.12 = [10 x i8] c"tmpfile-2\00"
@.str.13 = [10 x i8] c"tmpfile-3\00"
@.str.14 = [7 x i8] c"tmpnam\00"
@.str.15 = [9 x i8] c"tmpnam-1\00"
@.str.16 = [9 x i8] c"tmpnam-2\00"
@.str.17 = [9 x i8] c"tmpnam-3\00"
define void @test_file() {
%1 = alloca i32*
%2 = alloca [1024 x i8]
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = load i32, i32* @L_tmpnam
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i8, i64 %7
store i64 %7, i64* %4
%10 = load i32, i32* @L_tmpnam
%11 = zext i32 %10 to i64
%12 = alloca i8, i64 %11
store i64 %11, i64* %5
%13 = call i32 @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @fclose(i32 %13)
%15 = call i32 @pr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @remove(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %0
%19 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %0
%21 = call i32 @remove(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%22 = icmp sge i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %23, %20
%26 = call i32 @pr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%27 = call i64 @rename(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%28 = icmp sge i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %31
31: ; preds = %29, %25
%32 = call i32 @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @fclose(i32 %32)
%34 = call i64 @rename(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%35 = icmp slt i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
br label %38
38: ; preds = %36, %31
%39 = call i64 @rename(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%40 = icmp sge i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %43
43: ; preds = %41, %38
%44 = call i32 @remove(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%45 = call i32 @pr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%46 = call i32* (...) @tmpfile()
store i32* %46, i32** %1
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %50
48: ; preds = %43
%49 = call i32 @fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
br label %50
50: ; preds = %48, %43
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%52 = call i32 @memset(i8* %51, i32 165, i32 1024)
%53 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%54 = load i32*, i32** %1
%55 = call i32 @fwrite(i8* %53, i32 1, i32 1024, i32* %54)
%56 = icmp ne i32 %55, 1024
br i1 %56, label %57, label %59
57: ; preds = %50
%58 = call i32 @fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
br label %59
59: ; preds = %57, %50
%60 = load i32*, i32** %1
%61 = call i32 @rewind(i32* %60)
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%63 = load i32*, i32** %1
%64 = call i32 @fread(i8* %62, i32 1, i32 1024, i32* %63)
%65 = icmp ne i32 %64, 1024
br i1 %65, label %66, label %68
66: ; preds = %59
%67 = call i32 @fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
br label %68
68: ; preds = %66, %59
%69 = call i32 @pr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%70 = call i32* @tmpnam(i8* %9)
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %74
72: ; preds = %68
%73 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
br label %74
74: ; preds = %72, %68
%75 = call i32 @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%76 = call i32 @fclose(i32 %75)
%77 = call i32* @tmpnam(i8* %12)
%78 = icmp eq i32* %77, null
br i1 %78, label %79, label %81
79: ; preds = %74
%80 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0))
br label %81
81: ; preds = %79, %74
%82 = call i32 @strcmp(i8* %9, i8* %12)
%83 = icmp ne i32 %82, 0
br i1 %83, label %86, label %84
84: ; preds = %81
%85 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0))
br label %86
86: ; preds = %84, %81
%87 = call i32 @remove(i8* %9)
%88 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
@L_tmpnam = global i32 0
@.str = [10 x i8] c"stdio.tmp\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [7 x i8] c"remove\00"
@.str.3 = [9 x i8] c"remove-1\00"
@.str.4 = [9 x i8] c"remove-2\00"
@.str.5 = [7 x i8] c"rename\00"
@.str.6 = [11 x i8] c"stdio2.tmp\00"
@.str.7 = [9 x i8] c"rename-1\00"
@.str.8 = [9 x i8] c"rename-2\00"
@.str.9 = [9 x i8] c"rename-3\00"
@.str.10 = [8 x i8] c"tmpfile\00"
@.str.11 = [10 x i8] c"tmpfile-1\00"
@.str.12 = [10 x i8] c"tmpfile-2\00"
@.str.13 = [10 x i8] c"tmpfile-3\00"
@.str.14 = [7 x i8] c"tmpnam\00"
@.str.15 = [9 x i8] c"tmpnam-1\00"
@.str.16 = [9 x i8] c"tmpnam-2\00"
@.str.17 = [9 x i8] c"tmpnam-3\00"
define void @test_file() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @L_tmpnam
%4 = zext i32 %3 to i64
%5 = tail call i8* @llvm.stacksave()
%6 = alloca i8, i64 %4
%7 = load i32, i32* @L_tmpnam
%8 = zext i32 %7 to i64
%9 = alloca i8, i64 %8
%10 = tail call i32 @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @fclose(i32 %10)
%12 = tail call i32 @pr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @remove(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = tail call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %17
17: ; preds = %15, %0
%18 = tail call i32 @remove(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%19 = icmp sgt i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = tail call i32 @pr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%24 = tail call i64 @rename(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%25 = icmp sgt i64 %24, -1
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = tail call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %28
28: ; preds = %26, %22
%29 = tail call i32 @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%30 = tail call i32 @fclose(i32 %29)
%31 = tail call i64 @rename(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = tail call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
br label %35
35: ; preds = %33, %28
%36 = tail call i64 @rename(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%37 = icmp sgt i64 %36, -1
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = tail call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %40
40: ; preds = %38, %35
%41 = tail call i32 @remove(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%42 = tail call i32 @pr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%43 = tail call i32* (...) @tmpfile()
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %47
45: ; preds = %40
%46 = tail call i32 @fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.11, i64 0, i64 0))
br label %47
47: ; preds = %45, %40
%48 = call i32 @memset(i8* %2, i32 165, i32 1024)
%49 = call i32 @fwrite(i8* %2, i32 1, i32 1024, i32* %43)
%50 = icmp eq i32 %49, 1024
br i1 %50, label %53, label %51
51: ; preds = %47
%52 = call i32 @fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
br label %53
53: ; preds = %51, %47
%54 = call i32 @rewind(i32* %43)
%55 = call i32 @fread(i8* %2, i32 1, i32 1024, i32* %43)
%56 = icmp eq i32 %55, 1024
br i1 %56, label %59, label %57
57: ; preds = %53
%58 = call i32 @fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
br label %59
59: ; preds = %57, %53
%60 = call i32 @pr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%61 = call i32* @tmpnam(i8* %6)
%62 = icmp eq i32* %61, null
br i1 %62, label %63, label %65
63: ; preds = %59
%64 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0))
br label %65
65: ; preds = %63, %59
%66 = call i32 @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%67 = call i32 @fclose(i32 %66)
%68 = call i32* @tmpnam(i8* %9)
%69 = icmp eq i32* %68, null
br i1 %69, label %70, label %72
70: ; preds = %65
%71 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0))
br label %72
72: ; preds = %70, %65
%73 = call i32 @strcmp(i8* %6, i8* %9)
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %72
%76 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0))
br label %77
77: ; preds = %75, %72
%78 = call i32 @remove(i8* %6)
ret void
}