#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 time_t;
struct stat {
  int st_ctime;
  int st_mtime;
};
typedef int ssize_t;

/* Variables and functions */
int O_CREAT;
int O_RDWR;
int O_TRUNC;
int O_WRONLY;
int /*<<< orphan*/ S_IRWXU;
int close(int);
int errno;
int open(char *, int, ...);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int stat(char *, struct stat *);
int unlink(char *);
int write(int, char *, int);
int test_open(void) {
  int fd, rc;
  ssize_t len;
  struct stat buf;
  time_t ctime1, ctime2;
  time_t mtime1, mtime2;
  char *tmpname = "test-open.dat";
  fd = open(tmpname, O_CREAT | O_RDWR, S_IRWXU);
  if (fd < 0) {
    printf("Fail to create file %s, errno = %d at line %d!\n", tmpname, errno,
           425);
    return (1);
  }
  len = write(fd, "hello!\n", 6);
  if (len != 6) {
    printf("Fail to write file %s, errno = %d at line %d!\n", tmpname, errno,
           430);
    return (1);
  }
  rc = close(fd);
  if (rc < 0) {
    printf("Fail to close file %s, errno = %d at line %d!\n", tmpname, errno,
           435);
    return (1);
  }
  rc = stat(tmpname, &buf);
  if (rc < 0) {
    printf("Fail to stat file %s, errno = %d at line %d!\n", tmpname, errno,
           440);
    return (1);
  }
  ctime1 = buf.st_ctime;
  mtime1 = buf.st_mtime;
  sleep(1);
  fd = open(tmpname, O_WRONLY | O_TRUNC);
  if (fd < 0) {
    printf("Fail to create file %s, errno = %d at line %d!\n", tmpname, errno,
           448);
    return (1);
  }
  rc = close(fd);
  if (rc < 0) {
    printf("Fail to close file %s, errno = %d at line %d!\n", tmpname, errno,
           453);
    return (1);
  }
  rc = stat(tmpname, &buf);
  if (rc < 0) {
    printf("Fail to stat file %s, errno = %d at line %d!\n", tmpname, errno,
           458);
    return (1);
  }
  ctime2 = buf.st_ctime;
  mtime2 = buf.st_mtime;
  if (ctime2 - ctime1 < 1) {
    printf("Invalid ctime %ld - %ld at line %d!\n", (long)ctime1, (long)ctime2,
           464);
    return (1);
  }
  if (mtime2 - mtime1 < 1) {
    printf("Invalid mtime %ld - %ld at line %d!\n", (long)mtime1, (long)mtime2,
           468);
    return (1);
  }
  rc = unlink(tmpname);
  if (rc < 0) {
    printf("Fail to unlink %s, errno = %d at line %d!\n", tmpname, errno, 473);
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<test_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xe81(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    0x2e6a(%rip),%rax
mov    (%rax),%esi
mov    0x2e39(%rip),%rax
or     (%rax),%esi
mov    0x2e38(%rip),%rax
mov    (%rax),%edx
mov    $0x0,%al
call   1080 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    11e2 <test_open+0x72>
mov    -0x30(%rbp),%rsi
mov    0x2dff(%rip),%rax
mov    (%rax),%edx
lea    0xe44(%rip),%rdi
mov    $0x1a9,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <test_open+0x2fa>
mov    -0x8(%rbp),%edi
lea    0xe52(%rip),%rsi
mov    $0x6,%edx
call   1040 <write@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x6,-0x10(%rbp)
je     122f <test_open+0xbf>
mov    -0x30(%rbp),%rsi
mov    0x2db2(%rip),%rax
mov    (%rax),%edx
lea    0xe2f(%rip),%rdi
mov    $0x1ae,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <test_open+0x2fa>
mov    -0x8(%rbp),%edi
call   1060 <close@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1270 <test_open+0x100>
mov    -0x30(%rbp),%rsi
mov    0x2d71(%rip),%rax
mov    (%rax),%edx
lea    0xe1d(%rip),%rdi
mov    $0x1b3,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <test_open+0x2fa>
mov    -0x30(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <stat@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    12b6 <test_open+0x146>
mov    -0x30(%rbp),%rsi
mov    0x2d2b(%rip),%rax
mov    (%rax),%edx
lea    0xe06(%rip),%rdi
mov    $0x1b8,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <test_open+0x2fa>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    $0x1,%edi
call   1090 <sleep@plt>
mov    -0x30(%rbp),%rdi
mov    0x2cd9(%rip),%rax
mov    (%rax),%esi
mov    0x2d10(%rip),%rax
or     (%rax),%esi
mov    $0x0,%al
call   1080 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1322 <test_open+0x1b2>
mov    -0x30(%rbp),%rsi
mov    0x2cbf(%rip),%rax
mov    (%rax),%edx
lea    0xd04(%rip),%rdi
mov    $0x1c0,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <test_open+0x2fa>
mov    -0x8(%rbp),%edi
call   1060 <close@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1363 <test_open+0x1f3>
mov    -0x30(%rbp),%rsi
mov    0x2c7e(%rip),%rax
mov    (%rax),%edx
lea    0xd2a(%rip),%rdi
mov    $0x1c5,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <test_open+0x2fa>
mov    -0x30(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <stat@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    13a9 <test_open+0x239>
mov    -0x30(%rbp),%rsi
mov    0x2c38(%rip),%rax
mov    (%rax),%edx
lea    0xd13(%rip),%rdi
mov    $0x1ca,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <test_open+0x2fa>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%eax
sub    -0x1c(%rbp),%eax
cmp    $0x1,%eax
jge    13eb <test_open+0x27b>
movslq -0x1c(%rbp),%rsi
movslq -0x20(%rbp),%rdx
lea    0xcff(%rip),%rdi
mov    $0x1d0,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <test_open+0x2fa>
mov    -0x28(%rbp),%eax
sub    -0x24(%rbp),%eax
cmp    $0x1,%eax
jge    1421 <test_open+0x2b1>
movslq -0x24(%rbp),%rsi
movslq -0x28(%rbp),%rdx
lea    0xcee(%rip),%rdi
mov    $0x1d4,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <test_open+0x2fa>
mov    -0x30(%rbp),%rdi
call   1030 <unlink@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1463 <test_open+0x2f3>
mov    -0x30(%rbp),%rsi
mov    0x2b7e(%rip),%rax
mov    (%rax),%edx
lea    0xcd1(%rip),%rdi
mov    $0x1d9,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    146a <test_open+0x2fa>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_open>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2e78(%rip),%rax
mov    0x2e49(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e46(%rip),%rax
mov    (%rax),%edx
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1080 <open@plt>
test   %eax,%eax
js     12ac <test_open+0x13c>
mov    %eax,%ebx
lea    0xe8b(%rip),%rsi
mov    %eax,%edi
mov    $0x6,%edx
call   1040 <write@plt>
cmp    $0x6,%eax
jne    12cd <test_open+0x15d>
mov    %ebx,%edi
call   1060 <close@plt>
test   %eax,%eax
js     12ee <test_open+0x17e>
lea    0xe22(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1070 <stat@plt>
test   %eax,%eax
js     130c <test_open+0x19c>
movslq 0x8(%rsp),%r15
movslq 0xc(%rsp),%r14
mov    $0x1,%ebx
mov    $0x1,%edi
call   1090 <sleep@plt>
mov    0x2da0(%rip),%rax
mov    0x2dd9(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xdde(%rip),%rdi
xor    %eax,%eax
call   1080 <open@plt>
test   %eax,%eax
js     132a <test_open+0x1ba>
mov    %eax,%edi
call   1060 <close@plt>
test   %eax,%eax
js     134f <test_open+0x1df>
lea    0xdb9(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1070 <stat@plt>
test   %eax,%eax
js     136d <test_open+0x1fd>
movslq 0x8(%rsp),%rdx
cmp    %r15d,%edx
jle    13a1 <test_open+0x231>
movslq 0xc(%rsp),%rdx
cmp    %r14d,%edx
jle    13b2 <test_open+0x242>
lea    0xd84(%rip),%rdi
call   1030 <unlink@plt>
xor    %ebx,%ebx
test   %eax,%eax
jns    1395 <test_open+0x225>
mov    0x2d2e(%rip),%rax
mov    (%rax),%edx
lea    0xe81(%rip),%rdi
lea    0xd5e(%rip),%rsi
mov    $0x1d9,%ecx
jmp    1389 <test_open+0x219>
mov    0x2d0d(%rip),%rax
mov    (%rax),%edx
lea    0xd52(%rip),%rdi
lea    0xd3d(%rip),%rsi
mov    $0x1a9,%ecx
jmp    1389 <test_open+0x219>
mov    0x2cec(%rip),%rax
mov    (%rax),%edx
lea    0xd69(%rip),%rdi
lea    0xd1c(%rip),%rsi
mov    $0x1ae,%ecx
jmp    1389 <test_open+0x219>
mov    0x2ccb(%rip),%rax
mov    (%rax),%edx
lea    0xd77(%rip),%rdi
lea    0xcfb(%rip),%rsi
mov    $0x1b3,%ecx
jmp    1389 <test_open+0x219>
mov    0x2cad(%rip),%rax
mov    (%rax),%edx
lea    0xd88(%rip),%rdi
lea    0xcdd(%rip),%rsi
mov    $0x1b8,%ecx
jmp    1389 <test_open+0x219>
mov    0x2c8f(%rip),%rax
mov    (%rax),%edx
lea    0xcd4(%rip),%rdi
lea    0xcbf(%rip),%rsi
mov    $0x1c0,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1395 <test_open+0x225>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edx
lea    0xd16(%rip),%rdi
lea    0xc9a(%rip),%rsi
mov    $0x1c5,%ecx
jmp    1389 <test_open+0x219>
mov    0x2c4c(%rip),%rax
mov    (%rax),%edx
lea    0xd27(%rip),%rdi
lea    0xc7c(%rip),%rsi
mov    $0x1ca,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xd2a(%rip),%rdi
mov    %r15,%rsi
mov    $0x1d0,%ecx
jmp    13c1 <test_open+0x251>
lea    0xd3e(%rip),%rdi
mov    %r14,%rsi
mov    $0x1d4,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1390 <test_open+0x220>

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
@.str = [14 x i8] c"test-open.dat\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@S_IRWXU = global i32 0
@.str.1 = [48 x i8] c"Fail to create file %s, errno = %d at line %d!\0A\00"
@errno = global i32 0
@.str.2 = [8 x i8] c"hello!\0A\00"
@.str.3 = [47 x i8] c"Fail to write file %s, errno = %d at line %d!\0A\00"
@.str.4 = [47 x i8] c"Fail to close file %s, errno = %d at line %d!\0A\00"
@.str.5 = [46 x i8] c"Fail to stat file %s, errno = %d at line %d!\0A\00"
@O_WRONLY = global i32 0
@O_TRUNC = global i32 0
@.str.6 = [37 x i8] c"Invalid ctime %ld - %ld at line %d!\0A\00"
@.str.7 = [37 x i8] c"Invalid mtime %ld - %ld at line %d!\0A\00"
@.str.8 = [43 x i8] c"Fail to unlink %s, errno = %d at line %d!\0A\00"
define i32 @test_open() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.stat
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %10
%11 = load i8*, i8** %10
%12 = load i32, i32* @O_CREAT
%13 = load i32, i32* @O_RDWR
%14 = or i32 %12, %13
%15 = load i32, i32* @S_IRWXU
%16 = call i32 (i8*, i32, ...) @open(i8* %11, i32 %14, i32 %15)
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %0
%20 = load i8*, i8** %10
%21 = load i32, i32* @errno
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %20, i32 %21, i32 425)
store i32 1, i32* %1
br label %121
23: ; preds = %0
%24 = load i32, i32* %2
%25 = call i32 @write(i32 %24, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 6)
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = icmp ne i32 %26, 6
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = load i8*, i8** %10
%30 = load i32, i32* @errno
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* %29, i32 %30, i32 430)
store i32 1, i32* %1
br label %121
32: ; preds = %23
%33 = load i32, i32* %2
%34 = call i32 @close(i32 %33)
store i32 %34, i32* %3
%35 = load i32, i32* %3
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %32
%38 = load i8*, i8** %10
%39 = load i32, i32* @errno
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i8* %38, i32 %39, i32 435)
store i32 1, i32* %1
br label %121
41: ; preds = %32
%42 = load i8*, i8** %10
%43 = call i32 @stat(i8* %42, %struct.stat* %5)
store i32 %43, i32* %3
%44 = load i32, i32* %3
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %41
%47 = load i8*, i8** %10
%48 = load i32, i32* @errno
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i8* %47, i32 %48, i32 440)
store i32 1, i32* %1
br label %121
50: ; preds = %41
%51 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%52 = load i32, i32* %51
store i32 %52, i32* %6
%53 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 1
%54 = load i32, i32* %53
store i32 %54, i32* %8
%55 = call i32 @sleep(i32 1)
%56 = load i8*, i8** %10
%57 = load i32, i32* @O_WRONLY
%58 = load i32, i32* @O_TRUNC
%59 = or i32 %57, %58
%60 = call i32 (i8*, i32, ...) @open(i8* %56, i32 %59)
store i32 %60, i32* %2
%61 = load i32, i32* %2
%62 = icmp slt i32 %61, 0
br i1 %62, label %63, label %67
63: ; preds = %50
%64 = load i8*, i8** %10
%65 = load i32, i32* @errno
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %64, i32 %65, i32 448)
store i32 1, i32* %1
br label %121
67: ; preds = %50
%68 = load i32, i32* %2
%69 = call i32 @close(i32 %68)
store i32 %69, i32* %3
%70 = load i32, i32* %3
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %67
%73 = load i8*, i8** %10
%74 = load i32, i32* @errno
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i8* %73, i32 %74, i32 453)
store i32 1, i32* %1
br label %121
76: ; preds = %67
%77 = load i8*, i8** %10
%78 = call i32 @stat(i8* %77, %struct.stat* %5)
store i32 %78, i32* %3
%79 = load i32, i32* %3
%80 = icmp slt i32 %79, 0
br i1 %80, label %81, label %85
81: ; preds = %76
%82 = load i8*, i8** %10
%83 = load i32, i32* @errno
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i8* %82, i32 %83, i32 458)
store i32 1, i32* %1
br label %121
85: ; preds = %76
%86 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%87 = load i32, i32* %86
store i32 %87, i32* %7
%88 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 1
%89 = load i32, i32* %88
store i32 %89, i32* %9
%90 = load i32, i32* %7
%91 = load i32, i32* %6
%92 = sub nsw i32 %90, %91
%93 = icmp slt i32 %92, 1
br i1 %93, label %94, label %100
94: ; preds = %85
%95 = load i32, i32* %6
%96 = sext i32 %95 to i64
%97 = load i32, i32* %7
%98 = sext i32 %97 to i64
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i64 %96, i64 %98, i32 464)
store i32 1, i32* %1
br label %121
100: ; preds = %85
%101 = load i32, i32* %9
%102 = load i32, i32* %8
%103 = sub nsw i32 %101, %102
%104 = icmp slt i32 %103, 1
br i1 %104, label %105, label %111
105: ; preds = %100
%106 = load i32, i32* %8
%107 = sext i32 %106 to i64
%108 = load i32, i32* %9
%109 = sext i32 %108 to i64
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i64 %107, i64 %109, i32 468)
store i32 1, i32* %1
br label %121
111: ; preds = %100
%112 = load i8*, i8** %10
%113 = call i32 @unlink(i8* %112)
store i32 %113, i32* %3
%114 = load i32, i32* %3
%115 = icmp slt i32 %114, 0
br i1 %115, label %116, label %120
116: ; preds = %111
%117 = load i8*, i8** %10
%118 = load i32, i32* @errno
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i8* %117, i32 %118, i32 473)
store i32 1, i32* %1
br label %121
120: ; preds = %111
store i32 0, i32* %1
br label %121
121: ; preds = %120, %116, %105, %94, %81, %72, %63, %46, %37, %28, %19
%122 = load i32, i32* %1
ret i32 %122
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
@.str = [14 x i8] c"test-open.dat\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@S_IRWXU = global i32 0
@.str.1 = [48 x i8] c"Fail to create file %s, errno = %d at line %d!\0A\00"
@errno = global i32 0
@.str.2 = [8 x i8] c"hello!\0A\00"
@.str.3 = [47 x i8] c"Fail to write file %s, errno = %d at line %d!\0A\00"
@.str.4 = [47 x i8] c"Fail to close file %s, errno = %d at line %d!\0A\00"
@.str.5 = [46 x i8] c"Fail to stat file %s, errno = %d at line %d!\0A\00"
@O_WRONLY = global i32 0
@O_TRUNC = global i32 0
@.str.6 = [37 x i8] c"Invalid ctime %ld - %ld at line %d!\0A\00"
@.str.7 = [37 x i8] c"Invalid mtime %ld - %ld at line %d!\0A\00"
@.str.8 = [43 x i8] c"Fail to unlink %s, errno = %d at line %d!\0A\00"
define i32 @test_open() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = load i32, i32* @O_CREAT
%4 = load i32, i32* @O_RDWR
%5 = or i32 %4, %3
%6 = load i32, i32* @S_IRWXU
%7 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* @errno
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %10, i32 425)
br label %76
12: ; preds = %0
%13 = tail call i32 @write(i32 %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 6)
%14 = icmp eq i32 %13, 6
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* @errno
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %16, i32 430)
br label %76
18: ; preds = %12
%19 = tail call i32 @close(i32 %7)
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* @errno
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %22, i32 435)
br label %76
24: ; preds = %18
%25 = call i32 @stat(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* @errno
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %28, i32 440)
br label %76
30: ; preds = %24
%31 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%32 = load i32, i32* %31
%33 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 1
%34 = load i32, i32* %33
%35 = tail call i32 @sleep(i32 1)
%36 = load i32, i32* @O_WRONLY
%37 = load i32, i32* @O_TRUNC
%38 = or i32 %37, %36
%39 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %38)
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %30
%42 = load i32, i32* @errno
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %42, i32 448)
br label %76
44: ; preds = %30
%45 = tail call i32 @close(i32 %39)
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = load i32, i32* @errno
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %48, i32 453)
br label %76
50: ; preds = %44
%51 = call i32 @stat(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = load i32, i32* @errno
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %54, i32 458)
br label %76
56: ; preds = %50
%57 = load i32, i32* %31
%58 = load i32, i32* %33
%59 = icmp sgt i32 %57, %32
br i1 %59, label %64, label %60
60: ; preds = %56
%61 = sext i32 %32 to i64
%62 = sext i32 %57 to i64
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i64 %61, i64 %62, i32 464)
br label %76
64: ; preds = %56
%65 = icmp sgt i32 %58, %34
br i1 %65, label %70, label %66
66: ; preds = %64
%67 = sext i32 %34 to i64
%68 = sext i32 %58 to i64
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0), i64 %67, i64 %68, i32 468)
br label %76
70: ; preds = %64
%71 = tail call i32 @unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%72 = icmp slt i32 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %70
%74 = load i32, i32* @errno
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %74, i32 473)
br label %76
76: ; preds = %70, %73, %66, %60, %53, %47, %41, %27, %21, %15, %9
%77 = phi i32 [ 1, %9 ], [ 1, %15 ], [ 1, %21 ], [ 1, %27 ], [ 1, %41 ], [ 1, %47 ], [ 1, %53 ], [ 1, %60 ], [ 1, %66 ], [ 1, %73 ], [ 0, %70 ]
ret i32 %77
}