#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 */
struct utimbuf {
  int /*<<< orphan*/ modtime;
  int /*<<< orphan*/ actime;
};
struct stat {
  int /*<<< orphan*/ st_mtime;
  int /*<<< orphan*/ st_atime;
};

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int errno;
int /*<<< orphan*/ free(char *);
int fstat(int, struct stat *);
int /*<<< orphan*/ minibuf_error(char *, char const *);
int mkstemp(char *);
int open(char const *, int /*<<< orphan*/, int /*<<< orphan*/);
size_t read(int, char *, int);
int rename(char *, char const *);
char const *strerror(int);
int unlink(char *);
int /*<<< orphan*/ utime(char const *, struct utimbuf *);
scalar_t__ write(int, char *, size_t);
int zasprintf(char **, char *, char const *);
int copy_file(const char *source, const char *dest) {
  char buf[BUFSIZ];
  int ifd, ofd, stat_valid, serrno;
  size_t len;
  struct stat st;
  char *tname;
  ifd = open(source, O_RDONLY, 0);
  if (ifd < 0) {
    minibuf_error("%s: unable to backup", source);
    return 0;
  }
  if (zasprintf(&tname, "%s_XXXXXXXXXX", dest) == -1) {
    minibuf_error("Cannot allocate temporary file name `%s'", strerror(errno));
    return 0;
  }
  ofd = mkstemp(tname);
  if (ofd == -1) {
    serrno = errno;
    close(ifd);
    minibuf_error("%s: unable to create backup", dest);
    free(tname);
    errno = serrno;
    return 0;
  }
  while ((len = read(ifd, buf, sizeof buf)) > 0)
    if (write(ofd, buf, len) < 0) {
      minibuf_error("Unable to write to backup file `%s'", dest);
      close(ifd);
      close(ofd);
      return 0;
    }
  serrno = errno;
  stat_valid = fstat(ifd, &st) != -1;
  close(ifd);
  close(ofd);
  if (stat_valid) {
    if (rename(tname, dest) == -1) {
      minibuf_error("Cannot rename temporary file `%s'", strerror(errno));
      (void)unlink(tname);
      stat_valid = 0;
    }
  } else if (unlink(tname) == -1)
    minibuf_error("Cannot remove temporary file `%s'", strerror(errno));
  free(tname);
  errno = serrno;
  if (stat_valid) {
    struct utimbuf t;
    t.actime = st.st_atime;
    t.modtime = st.st_mtime;
    utime(dest, &t);
  }
  return stat_valid;
}


x86 assembly (clang, -O0):
<copy_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2df1(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x70(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2dcd(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <open@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    1254 <copy_file+0x84>
mov    -0x10(%rbp),%rsi
lea    0xdc4(%rip),%rdi
call   1080 <minibuf_error@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x54(%rbp)
jmp    147b <copy_file+0x2ab>
mov    -0x18(%rbp),%rdx
lea    -0x50(%rbp),%rdi
lea    0xdb2(%rip),%rsi
call   10a0 <zasprintf@plt>
cmp    $0xffffffff,%eax
jne    12a1 <copy_file+0xd1>
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xd9a(%rip),%rdi
call   1080 <minibuf_error@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x54(%rbp)
jmp    147b <copy_file+0x2ab>
mov    -0x50(%rbp),%rdi
call   10b0 <mkstemp@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0xffffffff,-0x30(%rbp)
jne    1303 <copy_file+0x133>
mov    0x2d12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%edi
call   1070 <close@plt>
mov    -0x18(%rbp),%rsi
lea    0xd76(%rip),%rdi
call   1080 <minibuf_error@plt>
mov    -0x50(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%ecx
mov    0x2ce2(%rip),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x54(%rbp)
jmp    147b <copy_file+0x2ab>
jmp    1308 <copy_file+0x138>
mov    -0x68(%rbp),%rsi
mov    -0x70(%rbp),%rax
mov    -0x2c(%rbp),%edi
mov    %eax,%edx
call   1090 <read@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jbe    137a <copy_file+0x1aa>
mov    -0x68(%rbp),%rsi
mov    -0x30(%rbp),%edi
mov    -0x40(%rbp),%rdx
call   1060 <write@plt>
cmp    $0x0,%rax
jge    1375 <copy_file+0x1a5>
mov    -0x18(%rbp),%rsi
lea    0xd1b(%rip),%rdi
call   1080 <minibuf_error@plt>
mov    -0x2c(%rbp),%edi
call   1070 <close@plt>
mov    -0x30(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x54(%rbp)
jmp    147b <copy_file+0x2ab>
jmp    1308 <copy_file+0x138>
mov    0x2c4f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%edi
lea    -0x48(%rbp),%rsi
call   10f0 <fstat@plt>
cmp    $0xffffffff,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%edi
call   1070 <close@plt>
mov    -0x30(%rbp),%edi
call   1070 <close@plt>
cmpl   $0x0,-0x34(%rbp)
je     1402 <copy_file+0x232>
mov    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10d0 <rename@plt>
cmp    $0xffffffff,%eax
jne    13fd <copy_file+0x22d>
mov    0x2bf9(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xca4(%rip),%rdi
call   1080 <minibuf_error@plt>
mov    -0x50(%rbp),%rdi
call   1050 <unlink@plt>
movl   $0x0,-0x34(%rbp)
jmp    1436 <copy_file+0x266>
mov    -0x50(%rbp),%rdi
call   1050 <unlink@plt>
cmp    $0xffffffff,%eax
jne    1431 <copy_file+0x261>
mov    0x2bb5(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xc82(%rip),%rdi
call   1080 <minibuf_error@plt>
jmp    1436 <copy_file+0x266>
mov    -0x50(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%ecx
mov    0x2b87(%rip),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x34(%rbp)
je     146e <copy_file+0x29e>
mov    -0x44(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <utime@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x54(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_file>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,-0x38(%rbp)
mov    %rdi,%r14
mov    0x2de9(%rip),%rax
mov    (%rax),%r15d
mov    %rsp,%rbx
lea    0xf(%r15),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    0x2dde(%rip),%rax
mov    (%rax),%esi
xor    %r13d,%r13d
xor    %edx,%edx
call   10c0 <open@plt>
test   %eax,%eax
js     12ae <copy_file+0xde>
mov    %eax,%r12d
lea    0xded(%rip),%rsi
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%r14
mov    %r14,%rdx
call   10a0 <zasprintf@plt>
cmp    $0xffffffff,%eax
je     12c2 <copy_file+0xf2>
mov    -0x30(%rbp),%rdi
call   10b0 <mkstemp@plt>
cmp    $0xffffffff,%eax
je     12e4 <copy_file+0x114>
mov    %eax,%r13d
cs nopw 0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1090 <read@plt>
test   %rax,%rax
je     1319 <copy_file+0x149>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1060 <write@plt>
test   %rax,%rax
jns    1260 <copy_file+0x90>
lea    0xdd7(%rip),%rdi
mov    %r14,%rsi
call   1080 <minibuf_error@plt>
mov    %r12d,%edi
call   1070 <close@plt>
mov    %r13d,%edi
call   1070 <close@plt>
jmp    13e1 <copy_file+0x211>
lea    0xd4b(%rip),%rdi
mov    %r14,%rsi
call   1080 <minibuf_error@plt>
jmp    13e4 <copy_file+0x214>
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xd4c(%rip),%rdi
mov    %rax,%rsi
call   1080 <minibuf_error@plt>
jmp    13e1 <copy_file+0x211>
mov    %r14,%rbx
mov    0x2ce2(%rip),%r14
mov    (%r14),%r15d
mov    %r12d,%edi
call   1070 <close@plt>
lea    0xd4c(%rip),%rdi
mov    %rbx,%rsi
call   1080 <minibuf_error@plt>
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
mov    %r15d,(%r14)
jmp    13e1 <copy_file+0x211>
mov    0x2cb0(%rip),%rax
mov    (%rax),%r15d
lea    -0x48(%rbp),%rsi
mov    %r12d,%edi
call   10f0 <fstat@plt>
mov    %eax,%ebx
mov    %r12d,%edi
call   1070 <close@plt>
mov    %r13d,%edi
call   1070 <close@plt>
mov    -0x30(%rbp),%rdi
cmp    $0xffffffff,%ebx
je     1386 <copy_file+0x1b6>
mov    %r14,%rsi
call   10d0 <rename@plt>
cmp    $0xffffffff,%eax
je     13af <copy_file+0x1df>
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
mov    0x2c69(%rip),%rax
mov    %r15d,(%rax)
mov    -0x48(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x40(%rbp),%rsi
mov    %r14,%rdi
call   1030 <utime@plt>
mov    $0x1,%r13d
jmp    13e4 <copy_file+0x214>
call   1050 <unlink@plt>
cmp    $0xffffffff,%eax
mov    0x2c3b(%rip),%rbx
jne    13d5 <copy_file+0x205>
mov    (%rbx),%edi
call   10e0 <strerror@plt>
lea    0xd09(%rip),%rdi
mov    %rax,%rsi
call   1080 <minibuf_error@plt>
jmp    13d5 <copy_file+0x205>
mov    0x2c1a(%rip),%rbx
mov    (%rbx),%edi
call   10e0 <strerror@plt>
lea    0xcc8(%rip),%rdi
mov    %rax,%rsi
call   1080 <minibuf_error@plt>
mov    -0x30(%rbp),%rdi
call   1050 <unlink@plt>
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
mov    %r15d,(%rbx)
xor    %r13d,%r13d
mov    %r13d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
%struct.utimbuf = type { i32, i32 }
@BUFSIZ = global i32 0
@O_RDONLY = global i32 0
@.str = [21 x i8] c"%s: unable to backup\00"
@.str.1 = [14 x i8] c"%s_XXXXXXXXXX\00"
@.str.2 = [41 x i8] c"Cannot allocate temporary file name `%s'\00"
@errno = global i32 0
@.str.3 = [28 x i8] c"%s: unable to create backup\00"
@.str.4 = [36 x i8] c"Unable to write to backup file `%s'\00"
@.str.5 = [34 x i8] c"Cannot rename temporary file `%s'\00"
@.str.6 = [34 x i8] c"Cannot remove temporary file `%s'\00"
define i32 @copy_file(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i64
%13 = alloca %struct.stat
%14 = alloca i8*
%15 = alloca i32
%16 = alloca %struct.utimbuf
store i8* %0, i8** %4
store i8* %1, i8** %5
%17 = load i32, i32* @BUFSIZ
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %6
%20 = alloca i8, i64 %18
store i64 %18, i64* %7
%21 = load i8*, i8** %4
%22 = load i32, i32* @O_RDONLY
%23 = call i32 @open(i8* %21, i32 %22, i32 0)
store i32 %23, i32* %8
%24 = load i32, i32* %8
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %2
%27 = load i8*, i8** %4
%28 = call i32 @minibuf_error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %27)
store i32 0, i32* %3
store i32 1, i32* %15
br label %120
29: ; preds = %2
%30 = load i8*, i8** %5
%31 = call i32 @zasprintf(i8** %14, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %30)
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load i32, i32* @errno
%35 = call i8* @strerror(i32 %34)
%36 = call i32 @minibuf_error(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %35)
store i32 0, i32* %3
store i32 1, i32* %15
br label %120
37: ; preds = %29
%38 = load i8*, i8** %14
%39 = call i32 @mkstemp(i8* %38)
store i32 %39, i32* %9
%40 = load i32, i32* %9
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %51
42: ; preds = %37
%43 = load i32, i32* @errno
store i32 %43, i32* %11
%44 = load i32, i32* %8
%45 = call i32 @close(i32 %44)
%46 = load i8*, i8** %5
%47 = call i32 @minibuf_error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %46)
%48 = load i8*, i8** %14
%49 = call i32 @free(i8* %48)
%50 = load i32, i32* %11
store i32 %50, i32* @errno
store i32 0, i32* %3
store i32 1, i32* %15
br label %120
51: ; preds = %37
br label %52
52: ; preds = %69, %51
%53 = load i32, i32* %8
%54 = trunc i64 %18 to i32
%55 = call i64 @read(i32 %53, i8* %20, i32 %54)
store i64 %55, i64* %12
%56 = icmp ugt i64 %55, 0
br i1 %56, label %57, label %70
57: ; preds = %52
%58 = load i32, i32* %9
%59 = load i64, i64* %12
%60 = call i64 @write(i32 %58, i8* %20, i64 %59)
%61 = icmp slt i64 %60, 0
br i1 %61, label %62, label %69
62: ; preds = %57
%63 = load i8*, i8** %5
%64 = call i32 @minibuf_error(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8* %63)
%65 = load i32, i32* %8
%66 = call i32 @close(i32 %65)
%67 = load i32, i32* %9
%68 = call i32 @close(i32 %67)
store i32 0, i32* %3
store i32 1, i32* %15
br label %120
69: ; preds = %57
br label %52
70: ; preds = %52
%71 = load i32, i32* @errno
store i32 %71, i32* %11
%72 = load i32, i32* %8
%73 = call i32 @fstat(i32 %72, %struct.stat* %13)
%74 = icmp ne i32 %73, -1
%75 = zext i1 %74 to i32
store i32 %75, i32* %10
%76 = load i32, i32* %8
%77 = call i32 @close(i32 %76)
%78 = load i32, i32* %9
%79 = call i32 @close(i32 %78)
%80 = load i32, i32* %10
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %94
82: ; preds = %70
%83 = load i8*, i8** %14
%84 = load i8*, i8** %5
%85 = call i32 @rename(i8* %83, i8* %84)
%86 = icmp eq i32 %85, -1
br i1 %86, label %87, label %93
87: ; preds = %82
%88 = load i32, i32* @errno
%89 = call i8* @strerror(i32 %88)
%90 = call i32 @minibuf_error(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* %89)
%91 = load i8*, i8** %14
%92 = call i32 @unlink(i8* %91)
store i32 0, i32* %10
br label %93
93: ; preds = %87, %82
br label %103
94: ; preds = %70
%95 = load i8*, i8** %14
%96 = call i32 @unlink(i8* %95)
%97 = icmp eq i32 %96, -1
br i1 %97, label %98, label %102
98: ; preds = %94
%99 = load i32, i32* @errno
%100 = call i8* @strerror(i32 %99)
%101 = call i32 @minibuf_error(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* %100)
br label %102
102: ; preds = %98, %94
br label %103
103: ; preds = %102, %93
%104 = load i8*, i8** %14
%105 = call i32 @free(i8* %104)
%106 = load i32, i32* %11
store i32 %106, i32* @errno
%107 = load i32, i32* %10
%108 = icmp ne i32 %107, 0
br i1 %108, label %109, label %118
109: ; preds = %103
%110 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 1
%111 = load i32, i32* %110
%112 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %16, i32 0, i32 1
store i32 %111, i32* %112
%113 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 0
%114 = load i32, i32* %113
%115 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %16, i32 0, i32 0
store i32 %114, i32* %115
%116 = load i8*, i8** %5
%117 = call i32 @utime(i8* %116, %struct.utimbuf* %16)
br label %118
118: ; preds = %109, %103
%119 = load i32, i32* %10
store i32 %119, i32* %3
store i32 1, i32* %15
br label %120
120: ; preds = %118, %62, %42, %33, %26
%121 = load i8*, i8** %6
%122 = load i32, i32* %3
ret i32 %122
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
%struct.utimbuf = type { i32, i32 }
@BUFSIZ = global i32 0
@O_RDONLY = global i32 0
@.str = [21 x i8] c"%s: unable to backup\00"
@.str.1 = [14 x i8] c"%s_XXXXXXXXXX\00"
@.str.2 = [41 x i8] c"Cannot allocate temporary file name `%s'\00"
@errno = global i32 0
@.str.3 = [28 x i8] c"%s: unable to create backup\00"
@.str.4 = [36 x i8] c"Unable to write to backup file `%s'\00"
@.str.5 = [34 x i8] c"Cannot rename temporary file `%s'\00"
@.str.6 = [34 x i8] c"Cannot remove temporary file `%s'\00"
define i32 @copy_file(i8* %0, i8* %1) {
%3 = alloca %struct.stat
%4 = alloca i8*
%5 = alloca %struct.utimbuf
%6 = load i32, i32* @BUFSIZ
%7 = zext i32 %6 to i64
%8 = alloca i8, i64 %7
%9 = bitcast %struct.stat* %3 to i8*
%10 = bitcast i8** %4 to i8*
%11 = load i32, i32* @O_RDONLY
%12 = tail call i32 @open(i8* %0, i32 %11, i32 0)
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = tail call i32 @minibuf_error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %82
16: ; preds = %2
%17 = call i32 @zasprintf(i8** %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* @errno
%21 = call i8* @strerror(i32 %20)
%22 = call i32 @minibuf_error(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %82
23: ; preds = %16
%24 = load i8*, i8** %4
%25 = call i32 @mkstemp(i8* %24)
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = load i32, i32* @errno
%29 = call i32 @close(i32 %12)
%30 = call i32 @minibuf_error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%31 = load i8*, i8** %4
%32 = call i32 @free(i8* %31)
store i32 %28, i32* @errno
br label %82
33: ; preds = %23, %36
%34 = call i64 @read(i32 %12, i8* %8, i32 %6)
%35 = icmp eq i64 %34, 0
br i1 %35, label %43, label %36
36: ; preds = %33
%37 = call i64 @write(i32 %25, i8* %8, i64 %34)
%38 = icmp slt i64 %37, 0
br i1 %38, label %39, label %33
39: ; preds = %36
%40 = call i32 @minibuf_error(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%41 = call i32 @close(i32 %12)
%42 = call i32 @close(i32 %25)
br label %82
43: ; preds = %33
%44 = load i32, i32* @errno
%45 = call i32 @fstat(i32 %12, %struct.stat* %3)
%46 = icmp eq i32 %45, -1
%47 = call i32 @close(i32 %12)
%48 = call i32 @close(i32 %25)
%49 = load i8*, i8** %4
br i1 %46, label %61, label %50
50: ; preds = %43
%51 = call i32 @rename(i8* %49, i8* %1)
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %71
53: ; preds = %50
%54 = load i32, i32* @errno
%55 = call i8* @strerror(i32 %54)
%56 = call i32 @minibuf_error(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* %55)
%57 = load i8*, i8** %4
%58 = call i32 @unlink(i8* %57)
%59 = load i8*, i8** %4
%60 = call i32 @free(i8* %59)
store i32 %44, i32* @errno
br label %82
61: ; preds = %43
%62 = call i32 @unlink(i8* %49)
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %68
64: ; preds = %61
%65 = load i32, i32* @errno
%66 = call i8* @strerror(i32 %65)
%67 = call i32 @minibuf_error(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* %66)
br label %68
68: ; preds = %61, %64
%69 = load i8*, i8** %4
%70 = call i32 @free(i8* %69)
store i32 %44, i32* @errno
br label %82
71: ; preds = %50
%72 = load i8*, i8** %4
%73 = call i32 @free(i8* %72)
store i32 %44, i32* @errno
%74 = bitcast %struct.utimbuf* %5 to i8*
%75 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%76 = load i32, i32* %75
%77 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i64 0, i32 1
store i32 %76, i32* %77
%78 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%79 = load i32, i32* %78
%80 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i64 0, i32 0
store i32 %79, i32* %80
%81 = call i32 @utime(i8* %1, %struct.utimbuf* %5)
br label %82
82: ; preds = %68, %53, %71, %39, %27, %19, %14
%83 = phi i32 [ 0, %14 ], [ 0, %19 ], [ 0, %27 ], [ 0, %39 ], [ 1, %71 ], [ 0, %68 ], [ 0, %53 ]
ret i32 %83
}