#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*/ tmp2;
typedef int /*<<< orphan*/ tmp1;
typedef int /*<<< orphan*/ msg;
typedef int /*<<< orphan*/ fn2;
typedef int /*<<< orphan*/ fn1;

/* Variables and functions */
int O_CREAT;
int O_DIRECTORY;
int O_EXCL;
int O_RDONLY;
int O_WRONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fdatasync(int);
int /*<<< orphan*/ fsync(int);
int open(char *, int, ...);
scalar_t__ rename(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
size_t strlen(char *);
int /*<<< orphan*/ write(int, char *, size_t);
int /*<<< orphan*/ xerror(char *);
int main(int ac, char **av) {
  char msg[64];
  snprintf(msg, sizeof(msg), "Hello world!\n");
  size_t msglen = strlen(msg);
  for (int i = 0; i < 300; i++) {
    char tmp1[64];
    snprintf(tmp1, sizeof(tmp1), "tmp.%d.1", i);
    char tmp2[64];
    snprintf(tmp2, sizeof(tmp2), "tmp.%d.2", i);
    char fn1[64];
    snprintf(fn1, sizeof(fn1), "q.%d.1", i);
    char fn2[64];
    snprintf(fn2, sizeof(fn2), "q.%d.2", i);
    int fd1 = open(tmp1, O_CREAT | O_EXCL | O_WRONLY, 0666);
    if (fd1 < 0)
      xerror("open1");
    write(fd1, msg, msglen);
    fdatasync(fd1);
    close(fd1);
    int fd2 = open(tmp2, O_CREAT | O_EXCL | O_WRONLY, 0666);
    if (fd2 < 0)
      xerror("open2");
    write(fd2, msg, msglen);
    fdatasync(fd2);
    close(fd2);
    if (rename(tmp1, fn1) < 0)
      xerror("rename1");
    int dirfd1 = open(".", O_RDONLY | O_DIRECTORY);
    if (dirfd1 < 0)
      xerror("opendir1");
    fsync(dirfd1);
    close(dirfd1);
    if (rename(tmp2, fn2) < 0)
      xerror("rename2");
    int dirfd2 = open(".", O_RDONLY | O_DIRECTORY);
    if (dirfd2 < 0)
      xerror("opendir2");
    fsync(dirfd2);
    close(dirfd2);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0x40,%esi
lea    0xe47(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
lea    -0x50(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
cmpl   $0x12c,-0x5c(%rbp)
jge    144b <main+0x2bb>
lea    -0xa0(%rbp),%rdi
mov    -0x5c(%rbp),%ecx
mov    $0x40,%esi
lea    0xe17(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x5c(%rbp),%ecx
mov    $0x40,%esi
lea    0xe03(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
lea    -0x120(%rbp),%rdi
mov    -0x5c(%rbp),%ecx
mov    $0x40,%esi
lea    0xdef(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x5c(%rbp),%ecx
mov    $0x40,%esi
lea    0xdd9(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
lea    -0xa0(%rbp),%rdi
mov    0x2d95(%rip),%rax
mov    (%rax),%esi
mov    0x2d5c(%rip),%rax
or     (%rax),%esi
mov    0x2d43(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
mov    $0x0,%al
call   10a0 <open@plt>
mov    %eax,-0x164(%rbp)
cmpl   $0x0,-0x164(%rbp)
jge    12a2 <main+0x112>
lea    0xd91(%rip),%rdi
call   1070 <xerror@plt>
mov    -0x164(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdx
call   1040 <write@plt>
mov    -0x164(%rbp),%edi
call   1030 <fdatasync@plt>
mov    -0x164(%rbp),%edi
call   1080 <close@plt>
lea    -0xe0(%rbp),%rdi
mov    0x2d1f(%rip),%rax
mov    (%rax),%esi
mov    0x2ce6(%rip),%rax
or     (%rax),%esi
mov    0x2ccd(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
mov    $0x0,%al
call   10a0 <open@plt>
mov    %eax,-0x168(%rbp)
cmpl   $0x0,-0x168(%rbp)
jge    1318 <main+0x188>
lea    0xd21(%rip),%rdi
call   1070 <xerror@plt>
mov    -0x168(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdx
call   1040 <write@plt>
mov    -0x168(%rbp),%edi
call   1030 <fdatasync@plt>
mov    -0x168(%rbp),%edi
call   1080 <close@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   10b0 <rename@plt>
cmp    $0x0,%rax
jge    136a <main+0x1da>
lea    0xcd5(%rip),%rdi
call   1070 <xerror@plt>
mov    0x2c6f(%rip),%rax
mov    (%rax),%esi
mov    0x2c56(%rip),%rax
or     (%rax),%esi
lea    0xcbf(%rip),%rdi
mov    $0x0,%al
call   10a0 <open@plt>
mov    %eax,-0x16c(%rbp)
cmpl   $0x0,-0x16c(%rbp)
jge    13a9 <main+0x219>
lea    0xca0(%rip),%rdi
call   1070 <xerror@plt>
mov    -0x16c(%rbp),%edi
call   1090 <fsync@plt>
mov    -0x16c(%rbp),%edi
call   1080 <close@plt>
lea    -0xe0(%rbp),%rdi
lea    -0x160(%rbp),%rsi
call   10b0 <rename@plt>
cmp    $0x0,%rax
jge    13e8 <main+0x258>
lea    0xc6a(%rip),%rdi
call   1070 <xerror@plt>
mov    0x2bf1(%rip),%rax
mov    (%rax),%esi
mov    0x2bd8(%rip),%rax
or     (%rax),%esi
lea    0xc41(%rip),%rdi
mov    $0x0,%al
call   10a0 <open@plt>
mov    %eax,-0x170(%rbp)
cmpl   $0x0,-0x170(%rbp)
jge    1427 <main+0x297>
lea    0xc33(%rip),%rdi
call   1070 <xerror@plt>
mov    -0x170(%rbp),%edi
call   1090 <fsync@plt>
mov    -0x170(%rbp),%edi
call   1080 <close@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    11d4 <main+0x44>
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x158,%rsp
lea    0xe58(%rip),%rdx
lea    0x110(%rsp),%r12
mov    %r12,%rdi
mov    $0x40,%esi
xor    %eax,%eax
call   1060 <snprintf@plt>
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %rax,%rbx
lea    0xd0(%rsp),%r15
lea    0x90(%rsp),%r14
mov    0x2e17(%rip),%rbp
xor    %r13d,%r13d
mov    %rax,0x8(%rsp)
jmp    1216 <main+0x86>
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1090 <fsync@plt>
mov    %ebp,%edi
call   1080 <close@plt>
add    $0x1,%r13d
cmp    $0x12c,%r13d
mov    0x2de8(%rip),%rbp
je     13f6 <main+0x266>
mov    %r15,%rdi
mov    $0x40,%esi
lea    0xde9(%rip),%rdx
mov    %r13d,%ecx
xor    %eax,%eax
call   1060 <snprintf@plt>
mov    %r14,%rdi
mov    $0x40,%esi
lea    0xdd9(%rip),%rdx
mov    %r13d,%ecx
xor    %eax,%eax
call   1060 <snprintf@plt>
lea    0x50(%rsp),%rdi
mov    $0x40,%esi
lea    0xdc7(%rip),%rdx
mov    %r13d,%ecx
xor    %eax,%eax
call   1060 <snprintf@plt>
lea    0x10(%rsp),%rdi
mov    $0x40,%esi
lea    0xdb3(%rip),%rdx
mov    %r13d,%ecx
xor    %eax,%eax
call   1060 <snprintf@plt>
mov    0x2d43(%rip),%rax
mov    (%rax),%esi
or     0x0(%rbp),%esi
mov    0x2d27(%rip),%rax
or     (%rax),%esi
mov    %r15,%rdi
mov    $0x1b6,%edx
xor    %eax,%eax
call   10a0 <open@plt>
mov    %eax,%r15d
test   %eax,%eax
jns    12b5 <main+0x125>
lea    0xd7e(%rip),%rdi
call   1070 <xerror@plt>
mov    %r15d,%edi
mov    %r12,%rbx
mov    %r12,%rsi
mov    0x8(%rsp),%r12
mov    %r12,%rdx
call   1040 <write@plt>
mov    %r15d,%edi
call   1030 <fdatasync@plt>
mov    %r15d,%edi
call   1080 <close@plt>
mov    0x2ce6(%rip),%rax
mov    (%rax),%esi
or     0x0(%rbp),%esi
mov    0x2cca(%rip),%rax
or     (%rax),%esi
mov    %r14,%rdi
mov    $0x1b6,%edx
xor    %eax,%eax
call   10a0 <open@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    1311 <main+0x181>
lea    0xd28(%rip),%rdi
call   1070 <xerror@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1040 <write@plt>
mov    %ebp,%edi
call   1030 <fdatasync@plt>
mov    %ebp,%edi
call   1080 <close@plt>
lea    0xd0(%rsp),%r15
mov    %r15,%rdi
lea    0x50(%rsp),%rsi
call   10b0 <rename@plt>
test   %rax,%rax
mov    %rbx,%r12
jns    1355 <main+0x1c5>
lea    0xcea(%rip),%rdi
call   1070 <xerror@plt>
mov    0x2c74(%rip),%rax
mov    (%rax),%esi
mov    0x2c7b(%rip),%rax
or     (%rax),%esi
lea    0xcd4(%rip),%rdi
xor    %eax,%eax
call   10a0 <open@plt>
mov    %eax,%ebp
test   %eax,%eax
lea    0x90(%rsp),%r14
jns    138f <main+0x1ff>
lea    0xcba(%rip),%rdi
call   1070 <xerror@plt>
mov    %ebp,%edi
call   1090 <fsync@plt>
mov    %ebp,%edi
call   1080 <close@plt>
mov    %r14,%rdi
lea    0x10(%rsp),%rsi
call   10b0 <rename@plt>
test   %rax,%rax
jns    13bb <main+0x22b>
lea    0xc97(%rip),%rdi
call   1070 <xerror@plt>
mov    0x2c0e(%rip),%rax
mov    (%rax),%esi
mov    0x2c15(%rip),%rax
or     (%rax),%esi
lea    0xc6e(%rip),%rdi
xor    %eax,%eax
call   10a0 <open@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    11f0 <main+0x60>
lea    0xc69(%rip),%rdi
call   1070 <xerror@plt>
jmp    11f0 <main+0x60>
xor    %eax,%eax
add    $0x158,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
@.str.1 = [9 x i8] c"tmp.%d.1\00"
@.str.2 = [9 x i8] c"tmp.%d.2\00"
@.str.3 = [7 x i8] c"q.%d.1\00"
@.str.4 = [7 x i8] c"q.%d.2\00"
@O_CREAT = global i32 0
@O_EXCL = global i32 0
@O_WRONLY = global i32 0
@.str.5 = [6 x i8] c"open1\00"
@.str.6 = [6 x i8] c"open2\00"
@.str.7 = [8 x i8] c"rename1\00"
@.str.8 = [2 x i8] c".\00"
@O_RDONLY = global i32 0
@O_DIRECTORY = global i32 0
@.str.9 = [9 x i8] c"opendir1\00"
@.str.10 = [8 x i8] c"rename2\00"
@.str.11 = [9 x i8] c"opendir2\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [64 x i8]
%7 = alloca i64
%8 = alloca i32
%9 = alloca [64 x i8]
%10 = alloca [64 x i8]
%11 = alloca [64 x i8]
%12 = alloca [64 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%18 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %17, i32 64, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%20 = call i64 @strlen(i8* %19)
store i64 %20, i64* %7
store i32 0, i32* %8
br label %21
21: ; preds = %117, %2
%22 = load i32, i32* %8
%23 = icmp slt i32 %22, 300
br i1 %23, label %24, label %120
24: ; preds = %21
%25 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%26 = load i32, i32* %8
%27 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %25, i32 64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%29 = load i32, i32* %8
%30 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %28, i32 64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [64 x i8], [64 x i8]* %11, i64 0, i64 0
%32 = load i32, i32* %8
%33 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %31, i32 64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%35 = load i32, i32* %8
%36 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %34, i32 64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%38 = load i32, i32* @O_CREAT
%39 = load i32, i32* @O_EXCL
%40 = or i32 %38, %39
%41 = load i32, i32* @O_WRONLY
%42 = or i32 %40, %41
%43 = call i32 (i8*, i32, ...) @open(i8* %37, i32 %42, i32 438)
store i32 %43, i32* %13
%44 = load i32, i32* %13
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %24
%47 = call i32 @xerror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %48
48: ; preds = %46, %24
%49 = load i32, i32* %13
%50 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%51 = load i64, i64* %7
%52 = call i32 @write(i32 %49, i8* %50, i64 %51)
%53 = load i32, i32* %13
%54 = call i32 @fdatasync(i32 %53)
%55 = load i32, i32* %13
%56 = call i32 @close(i32 %55)
%57 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%58 = load i32, i32* @O_CREAT
%59 = load i32, i32* @O_EXCL
%60 = or i32 %58, %59
%61 = load i32, i32* @O_WRONLY
%62 = or i32 %60, %61
%63 = call i32 (i8*, i32, ...) @open(i8* %57, i32 %62, i32 438)
store i32 %63, i32* %14
%64 = load i32, i32* %14
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %48
%67 = call i32 @xerror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %68
68: ; preds = %66, %48
%69 = load i32, i32* %14
%70 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%71 = load i64, i64* %7
%72 = call i32 @write(i32 %69, i8* %70, i64 %71)
%73 = load i32, i32* %14
%74 = call i32 @fdatasync(i32 %73)
%75 = load i32, i32* %14
%76 = call i32 @close(i32 %75)
%77 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%78 = getelementptr inbounds [64 x i8], [64 x i8]* %11, i64 0, i64 0
%79 = call i64 @rename(i8* %77, i8* %78)
%80 = icmp slt i64 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %68
%82 = call i32 @xerror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %83
83: ; preds = %81, %68
%84 = load i32, i32* @O_RDONLY
%85 = load i32, i32* @O_DIRECTORY
%86 = or i32 %84, %85
%87 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %86)
store i32 %87, i32* %15
%88 = load i32, i32* %15
%89 = icmp slt i32 %88, 0
br i1 %89, label %90, label %92
90: ; preds = %83
%91 = call i32 @xerror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %92
92: ; preds = %90, %83
%93 = load i32, i32* %15
%94 = call i32 @fsync(i32 %93)
%95 = load i32, i32* %15
%96 = call i32 @close(i32 %95)
%97 = getelementptr inbounds [64 x i8], [64 x i8]* %10, i64 0, i64 0
%98 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%99 = call i64 @rename(i8* %97, i8* %98)
%100 = icmp slt i64 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %92
%102 = call i32 @xerror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %103
103: ; preds = %101, %92
%104 = load i32, i32* @O_RDONLY
%105 = load i32, i32* @O_DIRECTORY
%106 = or i32 %104, %105
%107 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %106)
store i32 %107, i32* %16
%108 = load i32, i32* %16
%109 = icmp slt i32 %108, 0
br i1 %109, label %110, label %112
110: ; preds = %103
%111 = call i32 @xerror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
br label %112
112: ; preds = %110, %103
%113 = load i32, i32* %16
%114 = call i32 @fsync(i32 %113)
%115 = load i32, i32* %16
%116 = call i32 @close(i32 %115)
br label %117
117: ; preds = %112
%118 = load i32, i32* %8
%119 = add nsw i32 %118, 1
store i32 %119, i32* %8
br label %21
120: ; preds = %21
%121 = load i32, i32* %3
ret i32 %121
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello world!\0A\00"
@.str.1 = [9 x i8] c"tmp.%d.1\00"
@.str.2 = [9 x i8] c"tmp.%d.2\00"
@.str.3 = [7 x i8] c"q.%d.1\00"
@.str.4 = [7 x i8] c"q.%d.2\00"
@O_CREAT = global i32 0
@O_EXCL = global i32 0
@O_WRONLY = global i32 0
@.str.5 = [6 x i8] c"open1\00"
@.str.6 = [6 x i8] c"open2\00"
@.str.7 = [8 x i8] c"rename1\00"
@.str.8 = [2 x i8] c".\00"
@O_RDONLY = global i32 0
@O_DIRECTORY = global i32 0
@.str.9 = [9 x i8] c"opendir1\00"
@.str.10 = [8 x i8] c"rename2\00"
@.str.11 = [9 x i8] c"opendir2\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [64 x i8]
%4 = alloca [64 x i8]
%5 = alloca [64 x i8]
%6 = alloca [64 x i8]
%7 = alloca [64 x i8]
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%9 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %8, i32 64, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = call i64 @strlen(i8* %8)
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
br label %16
15: ; preds = %75
ret i32 0
16: ; preds = %2, %75
%17 = phi i32 [ 0, %2 ], [ %78, %75 ]
%18 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %11, i32 64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %12, i32 64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%20 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %13, i32 64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%21 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %14, i32 64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%22 = load i32, i32* @O_CREAT
%23 = load i32, i32* @O_EXCL
%24 = or i32 %23, %22
%25 = load i32, i32* @O_WRONLY
%26 = or i32 %24, %25
%27 = call i32 (i8*, i32, ...) @open(i8* %11, i32 %26, i32 438)
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %16
%30 = call i32 @xerror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %31
31: ; preds = %29, %16
%32 = call i32 @write(i32 %27, i8* %8, i64 %10)
%33 = call i32 @fdatasync(i32 %27)
%34 = call i32 @close(i32 %27)
%35 = load i32, i32* @O_CREAT
%36 = load i32, i32* @O_EXCL
%37 = or i32 %36, %35
%38 = load i32, i32* @O_WRONLY
%39 = or i32 %37, %38
%40 = call i32 (i8*, i32, ...) @open(i8* %12, i32 %39, i32 438)
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %31
%43 = call i32 @xerror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %44
44: ; preds = %42, %31
%45 = call i32 @write(i32 %40, i8* %8, i64 %10)
%46 = call i32 @fdatasync(i32 %40)
%47 = call i32 @close(i32 %40)
%48 = call i64 @rename(i8* %11, i8* %13)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %44
%51 = call i32 @xerror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %52
52: ; preds = %50, %44
%53 = load i32, i32* @O_RDONLY
%54 = load i32, i32* @O_DIRECTORY
%55 = or i32 %54, %53
%56 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %55)
%57 = icmp slt i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %52
%59 = call i32 @xerror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %60
60: ; preds = %58, %52
%61 = call i32 @fsync(i32 %56)
%62 = call i32 @close(i32 %56)
%63 = call i64 @rename(i8* %12, i8* %14)
%64 = icmp slt i64 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %60
%66 = call i32 @xerror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %67
67: ; preds = %65, %60
%68 = load i32, i32* @O_RDONLY
%69 = load i32, i32* @O_DIRECTORY
%70 = or i32 %69, %68
%71 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0), i32 %70)
%72 = icmp slt i32 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %67
%74 = call i32 @xerror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
br label %75
75: ; preds = %73, %67
%76 = call i32 @fsync(i32 %71)
%77 = call i32 @close(i32 %71)
%78 = add nuw nsw i32 %17, 1
%79 = icmp eq i32 %78, 300
br i1 %79, label %15, label %16
}