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

/* Variables and functions */
int O_APPEND;
int O_CREAT;
int O_TRUNC;
int O_WRONLY;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWGRP;
int S_IWUSR;
int /*<<< orphan*/ close(int);
int errno;
int fdatasync(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *);
int fsync(int);
int open(char *, int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ stderr;
char *strerror(int);
size_t write(int, char *, int);
int main(int argc, char *argv[]) {
  int fd;
  fd = open("/tmp/sync.txt", O_WRONLY | O_CREAT | O_TRUNC | O_APPEND,
            S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP | S_IROTH);
  if (fd == -1) {
    perror("open");
  }
  int i, n = 0;
  size_t nri, nrn = 0;
  char cc[2] = "0";
  for (i = 0; i < 10; i++) {
    for (n = 0; n < 10; n++) {
      cc[0] = (n + 0x30);
      nrn = write(fd, cc, 1);
      if (nrn == -1) {
        perror("write");
      } else if (nrn != 1) {
        printf("Failed to write all data, expected %d, wrote %d\n",
               (int)sizeof(int), (int)nrn);
      }
    }
    nri = write(fd, "\n", 1);
    if (nri == -1) {
      fprintf(stderr, "%s; [%d] %s\n", "failed to write", errno,
              strerror(errno));
      ;
    } else if (nri != 1) {
      printf("Failed to write all data, expected %d, wrote %d\n",
             (int)sizeof(char), (int)nri);
    }
  }
  int ret;
  ret = fsync(fd);
  if (ret == -1) {
    fprintf(stderr, "%s; [%d] %s\n", "Failed to fsync()", errno,
            strerror(errno));
    ;
  }
  ret = 0;
  ret = fdatasync(fd);
  if (ret == -1) {
    printf("Failed to fdatasync(), errno %d: %s", errno, strerror(errno));
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2de3(%rip),%rax
mov    (%rax),%esi
mov    0x2e42(%rip),%rax
or     (%rax),%esi
mov    0x2e31(%rip),%rax
or     (%rax),%esi
mov    0x2dc0(%rip),%rax
or     (%rax),%esi
mov    0x2dff(%rip),%rax
mov    (%rax),%edx
mov    0x2dc6(%rip),%rax
or     (%rax),%edx
mov    0x2df5(%rip),%rax
or     (%rax),%edx
mov    0x2dc4(%rip),%rax
or     (%rax),%edx
mov    0x2db3(%rip),%rax
or     (%rax),%edx
lea    0xe02(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    121c <main+0x8c>
lea    0xdf7(%rip),%rdi
call   10a0 <perror@plt>
movl   $0x0,-0x1c(%rbp)
movq   $0x0,-0x30(%rbp)
mov    0xde1(%rip),%ax
mov    %ax,-0x32(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    1374 <main+0x1e4>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    12ce <main+0x13e>
mov    -0x1c(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x32(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x32(%rbp),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0xffffffffffffffff,-0x30(%rbp)
jne    1292 <main+0x102>
lea    0xdd5(%rip),%rdi
call   10a0 <perror@plt>
jmp    12bb <main+0x12b>
cmpq   $0x1,-0x30(%rbp)
je     12b6 <main+0x126>
mov    -0x30(%rbp),%rax
mov    %eax,%edx
lea    0xd6b(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12bb <main+0x12b>
jmp    12c0 <main+0x130>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    124e <main+0xbe>
mov    -0x14(%rbp),%edi
lea    0xd6c(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0xffffffffffffffff,-0x28(%rbp)
jne    1338 <main+0x1a8>
mov    0x2cc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2cb4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2ca8(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%ecx
mov    %rax,%r8
lea    0xd1f(%rip),%rsi
lea    0xd25(%rip),%rdx
call   1070 <fprintf@plt>
jmp    1361 <main+0x1d1>
cmpq   $0x1,-0x28(%rbp)
je     135c <main+0x1cc>
mov    -0x28(%rbp),%rax
mov    %eax,%edx
lea    0xcc5(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1361 <main+0x1d1>
jmp    1366 <main+0x1d6>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    123d <main+0xad>
mov    -0x14(%rbp),%edi
call   1080 <fsync@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    13cb <main+0x23b>
mov    0x2c30(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2c1c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2c10(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x48(%rbp),%edi
mov    -0x44(%rbp),%ecx
mov    %rax,%r8
lea    0xc87(%rip),%rsi
lea    0xc9d(%rip),%rdx
call   1070 <fprintf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <fdatasync@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    1415 <main+0x285>
mov    0x2bca(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2bbe(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x4c(%rbp),%esi
mov    %rax,%rdx
lea    0xc67(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2dee(%rip),%rax
mov    0x2e4f(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e3c(%rip),%rax
or     (%rax),%esi
mov    0x2dcb(%rip),%rax
or     (%rax),%esi
mov    0x2e0a(%rip),%rax
mov    0x2dd3(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2e00(%rip),%rax
or     (%rax),%edx
mov    0x2dcf(%rip),%rax
or     (%rax),%edx
mov    0x2dbe(%rip),%rax
or     (%rax),%edx
lea    0xe0d(%rip),%rdi
call   1090 <open@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     139d <main+0x20d>
movw   $0x30,0x6(%rsp)
lea    0x6(%rsp),%r14
lea    0xe2c(%rip),%r15
lea    0xdf6(%rip),%r13
xor    %r12d,%r12d
jmp    124f <main+0xbf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rdi
mov    $0x1,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r12d
cmp    $0xa,%r12d
je     1315 <main+0x185>
mov    $0xfffffff6,%ebp
jmp    1275 <main+0xe5>
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    $0x4,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
inc    %ebp
je     12b0 <main+0x120>
lea    0x3a(%rbp),%eax
mov    %al,0x6(%rsp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
cmp    $0x1,%rax
je     1271 <main+0xe1>
cmp    $0xffffffffffffffff,%rax
jne    1260 <main+0xd0>
lea    0xdbd(%rip),%rdi
call   10a0 <perror@plt>
jmp    1271 <main+0xe1>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
cmp    $0x1,%rax
je     1241 <main+0xb1>
cmp    $0xffffffffffffffff,%rax
jne    1230 <main+0xa0>
mov    0x2ce6(%rip),%rax
mov    (%rax),%ebp
mov    0x2cd5(%rip),%rax
mov    (%rax),%r15d
mov    %r15d,%edi
call   10b0 <strerror@plt>
mov    %ebp,%edi
lea    0xd4d(%rip),%rsi
lea    0xd53(%rip),%rdx
mov    %r15d,%ecx
lea    0xd3a(%rip),%r15
mov    %rax,%r8
call   1070 <fprintf@plt>
jmp    1241 <main+0xb1>
mov    %ebx,%edi
call   1080 <fsync@plt>
cmp    $0xffffffff,%eax
jne    1356 <main+0x1c6>
mov    0x2c98(%rip),%rax
mov    (%rax),%r14d
mov    0x2c86(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xd02(%rip),%rsi
lea    0xd18(%rip),%rdx
mov    %r14d,%edi
mov    %ebp,%ecx
mov    %rax,%r8
call   1070 <fprintf@plt>
mov    %ebx,%edi
call   1030 <fdatasync@plt>
cmp    $0xffffffff,%eax
jne    1385 <main+0x1f5>
mov    0x2c4f(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xcfa(%rip),%rdi
mov    %ebp,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc6a(%rip),%rdi
call   10a0 <perror@plt>
jmp    1203 <main+0x73>

LLVM IR (-O0):
@.str = [14 x i8] c"/tmp/sync.txt\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@O_APPEND = global i32 0
@S_IWUSR = global i32 0
@S_IRUSR = global i32 0
@S_IWGRP = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.1 = [5 x i8] c"open\00"
@__const.main.cc = [2 x i8] c"0\00"
@.str.2 = [6 x i8] c"write\00"
@.str.3 = [49 x i8] c"Failed to write all data, expected %d, wrote %d\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
@stderr = global i32 0
@.str.5 = [13 x i8] c"%s; [%d] %s\0A\00"
@.str.6 = [16 x i8] c"failed to write\00"
@errno = global i32 0
@.str.7 = [18 x i8] c"Failed to fsync()\00"
@.str.8 = [36 x i8] c"Failed to fdatasync(), errno %d: %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i64
%11 = alloca [2 x i8]
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* @O_WRONLY
%14 = load i32, i32* @O_CREAT
%15 = or i32 %13, %14
%16 = load i32, i32* @O_TRUNC
%17 = or i32 %15, %16
%18 = load i32, i32* @O_APPEND
%19 = or i32 %17, %18
%20 = load i32, i32* @S_IWUSR
%21 = load i32, i32* @S_IRUSR
%22 = or i32 %20, %21
%23 = load i32, i32* @S_IWGRP
%24 = or i32 %22, %23
%25 = load i32, i32* @S_IRGRP
%26 = or i32 %24, %25
%27 = load i32, i32* @S_IROTH
%28 = or i32 %26, %27
%29 = call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %28)
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %34
32: ; preds = %2
%33 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %32, %2
store i32 0, i32* %8
store i64 0, i64* %10
%35 = bitcast [2 x i8]* %11 to i8*
store i32 0, i32* %7
br label %36
36: ; preds = %87, %34
%37 = load i32, i32* %7
%38 = icmp slt i32 %37, 10
br i1 %38, label %39, label %90
39: ; preds = %36
store i32 0, i32* %8
br label %40
40: ; preds = %64, %39
%41 = load i32, i32* %8
%42 = icmp slt i32 %41, 10
br i1 %42, label %43, label %67
43: ; preds = %40
%44 = load i32, i32* %8
%45 = add nsw i32 %44, 48
%46 = trunc i32 %45 to i8
%47 = getelementptr inbounds [2 x i8], [2 x i8]* %11, i64 0, i64 0
store i8 %46, i8* %47
%48 = load i32, i32* %6
%49 = getelementptr inbounds [2 x i8], [2 x i8]* %11, i64 0, i64 0
%50 = call i64 @write(i32 %48, i8* %49, i32 1)
store i64 %50, i64* %10
%51 = load i64, i64* %10
%52 = icmp eq i64 %51, -1
br i1 %52, label %53, label %55
53: ; preds = %43
%54 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %63
55: ; preds = %43
%56 = load i64, i64* %10
%57 = icmp ne i64 %56, 1
br i1 %57, label %58, label %62
58: ; preds = %55
%59 = load i64, i64* %10
%60 = trunc i64 %59 to i32
%61 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 %60)
br label %62
62: ; preds = %58, %55
br label %63
63: ; preds = %62, %53
br label %64
64: ; preds = %63
%65 = load i32, i32* %8
%66 = add nsw i32 %65, 1
store i32 %66, i32* %8
br label %40
67: ; preds = %40
%68 = load i32, i32* %6
%69 = call i64 @write(i32 %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
store i64 %69, i64* %9
%70 = load i64, i64* %9
%71 = icmp eq i64 %70, -1
br i1 %71, label %72, label %78
72: ; preds = %67
%73 = load i32, i32* @stderr
%74 = load i32, i32* @errno
%75 = load i32, i32* @errno
%76 = call i8* @strerror(i32 %75)
%77 = call i32 @fprintf(i32 %73, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 %74, i8* %76)
br label %86
78: ; preds = %67
%79 = load i64, i64* %9
%80 = icmp ne i64 %79, 1
br i1 %80, label %81, label %85
81: ; preds = %78
%82 = load i64, i64* %9
%83 = trunc i64 %82 to i32
%84 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %83)
br label %85
85: ; preds = %81, %78
br label %86
86: ; preds = %85, %72
br label %87
87: ; preds = %86
%88 = load i32, i32* %7
%89 = add nsw i32 %88, 1
store i32 %89, i32* %7
br label %36
90: ; preds = %36
%91 = load i32, i32* %6
%92 = call i32 @fsync(i32 %91)
store i32 %92, i32* %12
%93 = load i32, i32* %12
%94 = icmp eq i32 %93, -1
br i1 %94, label %95, label %101
95: ; preds = %90
%96 = load i32, i32* @stderr
%97 = load i32, i32* @errno
%98 = load i32, i32* @errno
%99 = call i8* @strerror(i32 %98)
%100 = call i32 @fprintf(i32 %96, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %97, i8* %99)
br label %101
101: ; preds = %95, %90
store i32 0, i32* %12
%102 = load i32, i32* %6
%103 = call i32 @fdatasync(i32 %102)
store i32 %103, i32* %12
%104 = load i32, i32* %12
%105 = icmp eq i32 %104, -1
br i1 %105, label %106, label %111
106: ; preds = %101
%107 = load i32, i32* @errno
%108 = load i32, i32* @errno
%109 = call i8* @strerror(i32 %108)
%110 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i32 %107, i8* %109)
br label %111
111: ; preds = %106, %101
%112 = load i32, i32* %6
%113 = call i32 @close(i32 %112)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"/tmp/sync.txt\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@O_APPEND = global i32 0
@S_IWUSR = global i32 0
@S_IRUSR = global i32 0
@S_IWGRP = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.1 = [5 x i8] c"open\00"
@.str.2 = [6 x i8] c"write\00"
@.str.3 = [49 x i8] c"Failed to write all data, expected %d, wrote %d\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
@stderr = global i32 0
@.str.5 = [13 x i8] c"%s; [%d] %s\0A\00"
@.str.6 = [16 x i8] c"failed to write\00"
@errno = global i32 0
@.str.7 = [18 x i8] c"Failed to fsync()\00"
@.str.8 = [36 x i8] c"Failed to fdatasync(), errno %d: %s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i16
%4 = load i32, i32* @O_WRONLY
%5 = load i32, i32* @O_CREAT
%6 = or i32 %5, %4
%7 = load i32, i32* @O_TRUNC
%8 = or i32 %6, %7
%9 = load i32, i32* @O_APPEND
%10 = or i32 %8, %9
%11 = load i32, i32* @S_IWUSR
%12 = load i32, i32* @S_IRUSR
%13 = or i32 %12, %11
%14 = load i32, i32* @S_IWGRP
%15 = or i32 %13, %14
%16 = load i32, i32* @S_IRGRP
%17 = or i32 %15, %16
%18 = load i32, i32* @S_IROTH
%19 = or i32 %17, %18
%20 = tail call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %19)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %2
%25 = bitcast i16* %3 to i8*
store i16 48, i16* %3
br label %26
26: ; preds = %24, %51
%27 = phi i32 [ 0, %24 ], [ %52, %51 ]
br label %28
28: ; preds = %26, %38
%29 = phi i32 [ 0, %26 ], [ %39, %38 ]
%30 = trunc i32 %29 to i8
%31 = add nuw nsw i8 %30, 48
store i8 %31, i8* %25
%32 = call i64 @write(i32 %20, i8* %25, i32 1)
switch i64 %32, label %35 [
i64 -1, label %33
i64 1, label %38
]
33: ; preds = %28
%34 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %38
35: ; preds = %28
%36 = trunc i64 %32 to i32
%37 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 %36)
br label %38
38: ; preds = %28, %33, %35
%39 = add nuw nsw i32 %29, 1
%40 = icmp eq i32 %39, 10
br i1 %40, label %41, label %28
41: ; preds = %38
%42 = tail call i64 @write(i32 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
switch i64 %42, label %48 [
i64 -1, label %43
i64 1, label %51
]
43: ; preds = %41
%44 = load i32, i32* @stderr
%45 = load i32, i32* @errno
%46 = tail call i8* @strerror(i32 %45)
%47 = tail call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 %45, i8* %46)
br label %51
48: ; preds = %41
%49 = trunc i64 %42 to i32
%50 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %49)
br label %51
51: ; preds = %41, %43, %48
%52 = add nuw nsw i32 %27, 1
%53 = icmp eq i32 %52, 10
br i1 %53, label %54, label %26
54: ; preds = %51
%55 = tail call i32 @fsync(i32 %20)
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %62
57: ; preds = %54
%58 = load i32, i32* @stderr
%59 = load i32, i32* @errno
%60 = tail call i8* @strerror(i32 %59)
%61 = tail call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %59, i8* %60)
br label %62
62: ; preds = %57, %54
%63 = tail call i32 @fdatasync(i32 %20)
%64 = icmp eq i32 %63, -1
br i1 %64, label %65, label %69
65: ; preds = %62
%66 = load i32, i32* @errno
%67 = tail call i8* @strerror(i32 %66)
%68 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i32 %66, i8* %67)
br label %69
69: ; preds = %65, %62
%70 = tail call i32 @close(i32 %20)
ret i32 0
}