#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 uint8_t;

/* Variables and functions */
int O_CREAT;
int O_RDONLY;
int O_RDWR;
int O_TRUNC;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ fsync(int);
int *malloc(size_t);
scalar_t__ memcmp(int *, int *, size_t);
int open(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, int *, size_t);
int /*<<< orphan*/ stdout;
int write(int, int *, size_t);
int big_file_test(int argc, char **argv) {
  unsigned long long size = 6LL * 1024 * 1024 * 1024;
  char *name = "file_big";
  uint8_t *data = NULL;
  uint8_t *read_data = NULL;
  size_t data_size = 512 * 1024;
  printf("size = %llu\n", size);
  data = malloc(data_size);
  if (data == NULL) {
    printf("mallco failed: %m\n");
    return -1;
  }
  for (int i = 0; i < data_size; i++)
    data[i] = i;
  read_data = malloc(data_size);
  if (read_data == NULL) {
    printf("mallco failed: %m\n");
    return -1;
  }
  int fd = open(name, O_RDWR | O_CREAT | O_TRUNC);
  if (fd < 0) {
    printf("  open %s for read failed: %m\n", name);
    return -1;
  }
  for (unsigned long long i = 0; i < size; i++) {
    printf("writen %lld Byte\r", i);
    fflush(stdout);
    int ret = write(fd, data, data_size);
    if (ret < 0) {
      printf("\n  write error: %m\n");
      return -1;
    }
    i += data_size;
    fsync(fd);
  }
  close(fd);
  fd = open(name, O_RDONLY);
  if (fd < 0) {
    printf("open for read failed: %m\n");
    return -1;
  }
  for (unsigned long long i = 0; i < size; i++) {
    printf("read %lld Byte\r", i);
    fflush(stdout);
    int ret = read(fd, read_data, data_size);
    if (ret < 0) {
      printf("\n read error: %m\n");
      return -1;
    }
    i += data_size;
    if (memcmp(data, read_data, data_size) != 0) {
      printf(" compare failed\n");
      return -1;
    }
  }
  close(fd);
  free(data);
  free(read_data);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<big_file_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0x180000000,%rax
mov    %rax,-0x18(%rbp)
lea    0xe3c(%rip),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x80000,-0x38(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1224 <big_file_test+0x84>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    149c <big_file_test+0x2fc>
movl   $0x0,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    1255 <big_file_test+0xb5>
mov    -0x3c(%rbp),%edx
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    122b <big_file_test+0x8b>
mov    -0x38(%rbp),%rdi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1287 <big_file_test+0xe7>
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    149c <big_file_test+0x2fc>
mov    -0x20(%rbp),%rdi
mov    0x2d46(%rip),%rax
mov    (%rax),%esi
mov    0x2d5d(%rip),%rax
or     (%rax),%esi
mov    0x2d4c(%rip),%rax
or     (%rax),%esi
call   10c0 <open@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jge    12d6 <big_file_test+0x136>
mov    -0x20(%rbp),%rsi
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    149c <big_file_test+0x2fc>
movq   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1368 <big_file_test+0x1c8>
mov    -0x48(%rbp),%rsi
lea    0xd51(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    -0x40(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1040 <write@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jge    1343 <big_file_test+0x1a3>
lea    0xd2a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    149c <big_file_test+0x2fc>
mov    -0x38(%rbp),%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%edi
call   10b0 <fsync@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    12de <big_file_test+0x13e>
mov    -0x40(%rbp),%edi
call   1060 <close@plt>
mov    -0x20(%rbp),%rdi
mov    0x2c55(%rip),%rax
mov    (%rax),%esi
call   10c0 <open@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jge    13a9 <big_file_test+0x209>
lea    0xcd8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    149c <big_file_test+0x2fc>
movq   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    146d <big_file_test+0x2cd>
mov    -0x58(%rbp),%rsi
lea    0xcbe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2be8(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    -0x40(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1070 <read@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
jge    1416 <big_file_test+0x276>
lea    0xc95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    149c <big_file_test+0x2fc>
mov    -0x38(%rbp),%rax
add    -0x58(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1080 <memcmp@plt>
cmp    $0x0,%rax
je     1457 <big_file_test+0x2b7>
lea    0xc66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    149c <big_file_test+0x2fc>
jmp    145c <big_file_test+0x2bc>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    13b1 <big_file_test+0x211>
mov    -0x40(%rbp),%edi
call   1060 <close@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
lea    0xc2b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<big_file_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movabs $0x17ff7ffff,%rax
lea    0x80001(%rax),%rsi
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x80000,%edi
call   10b0 <malloc@plt>
test   %rax,%rax
je     1443 <big_file_test+0x283>
mov    %rax,%rbx
movdqa 0xdf8(%rip),%xmm0
mov    $0x1c,%eax
movdqa 0xdfa(%rip),%xmm8
movdqa 0xe01(%rip),%xmm9
movdqa 0xe08(%rip),%xmm10
movdqa 0xe10(%rip),%xmm4
movdqa 0xe18(%rip),%xmm5
movdqa 0xe20(%rip),%xmm6
movdqa 0xe28(%rip),%xmm7
movdqa 0xe30(%rip),%xmm1
movdqa %xmm0,%xmm2
paddd  %xmm8,%xmm2
movdqu %xmm0,-0x70(%rbx,%rax,4)
movdqu %xmm2,-0x60(%rbx,%rax,4)
movdqa %xmm0,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm10,%xmm3
movdqu %xmm2,-0x50(%rbx,%rax,4)
movdqu %xmm3,-0x40(%rbx,%rax,4)
movdqa %xmm0,%xmm2
paddd  %xmm4,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm5,%xmm3
movdqu %xmm2,-0x30(%rbx,%rax,4)
movdqu %xmm3,-0x20(%rbx,%rax,4)
movdqa %xmm0,%xmm2
paddd  %xmm6,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm7,%xmm3
movdqu %xmm2,-0x10(%rbx,%rax,4)
movdqu %xmm3,(%rbx,%rax,4)
paddd  %xmm1,%xmm0
add    $0x20,%rax
cmp    $0x8001c,%rax
jne    1250 <big_file_test+0x90>
mov    $0x80000,%edi
call   10b0 <malloc@plt>
test   %rax,%rax
je     1443 <big_file_test+0x283>
mov    %rax,%r14
mov    0x2cf1(%rip),%rax
mov    0x2d0a(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2cf7(%rip),%rax
or     (%rax),%esi
lea    0xd8e(%rip),%rdi
call   10e0 <open@plt>
test   %eax,%eax
js     1465 <big_file_test+0x2a5>
mov    %eax,%r15d
mov    $0xfffffffffff7ffff,%rbp
lea    0xdb8(%rip),%r12
mov    0x2c99(%rip),%r13
nopw   0x0(%rax,%rax,1)
add    $0x80001,%rbp
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13),%edi
call   10c0 <fflush@plt>
mov    $0x80000,%edx
mov    %r15d,%edi
mov    %rbx,%rsi
call   1060 <write@plt>
test   %eax,%eax
js     147c <big_file_test+0x2bc>
mov    %r15d,%edi
call   10d0 <fsync@plt>
movabs $0x17ff7ffff,%rax
cmp    %rax,%rbp
jb     1330 <big_file_test+0x170>
mov    %r15d,%edi
call   1080 <close@plt>
mov    0x2c45(%rip),%rax
mov    (%rax),%esi
lea    0xcfc(%rip),%rdi
call   10e0 <open@plt>
test   %eax,%eax
js     1485 <big_file_test+0x2c5>
mov    %eax,%r15d
mov    $0xfffffffffff7ffff,%rbp
lea    0xd66(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x80001,%rbp
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13),%edi
call   10c0 <fflush@plt>
mov    $0x80000,%edx
mov    %r15d,%edi
mov    %r14,%rsi
call   1090 <read@plt>
test   %eax,%eax
js     148e <big_file_test+0x2ce>
mov    $0x80000,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   10a0 <memcmp@plt>
test   %rax,%rax
jne    1497 <big_file_test+0x2d7>
movabs $0x17ff7ffff,%rax
cmp    %rax,%rbp
jb     13c0 <big_file_test+0x200>
mov    %r15d,%edi
call   1080 <close@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
jmp    1456 <big_file_test+0x296>
lea    0xc5c(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc4d(%rip),%rdi
lea    0xc1d(%rip),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1451 <big_file_test+0x291>
lea    0xc67(%rip),%rdi
jmp    144a <big_file_test+0x28a>
lea    0xc72(%rip),%rdi
jmp    144a <big_file_test+0x28a>
lea    0xc93(%rip),%rdi
jmp    144a <big_file_test+0x28a>
lea    0xc9c(%rip),%rdi
call   1050 <puts@plt>
jmp    1451 <big_file_test+0x291>

LLVM IR (-O0):
@.str = [9 x i8] c"file_big\00"
@.str.1 = [13 x i8] c"size = %llu\0A\00"
@.str.2 = [19 x i8] c"mallco failed: %m\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.3 = [31 x i8] c" open %s for read failed: %m\0A\00"
@.str.4 = [18 x i8] c"writen %lld Byte\0D\00"
@stdout = global i32 0
@.str.5 = [20 x i8] c"\0A write error: %m\0A\00"
@O_RDONLY = global i32 0
@.str.6 = [26 x i8] c"open for read failed: %m\0A\00"
@.str.7 = [16 x i8] c"read %lld Byte\0D\00"
@.str.8 = [18 x i8] c"\0A read error: %m\0A\00"
@.str.9 = [17 x i8] c" compare failed\0A\00"
@.str.10 = [2 x i8] c"\0A\00"
define i32 @big_file_test(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
%14 = alloca i32
%15 = alloca i64
%16 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 6442450944, i64* %6
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %7
store i32* null, i32** %8
store i32* null, i32** %9
store i64 524288, i64* %10
%17 = load i64, i64* %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 %17)
%19 = load i64, i64* %10
%20 = call i32* @malloc(i64 %19)
store i32* %20, i32** %8
%21 = load i32*, i32** %8
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %25
23: ; preds = %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %138
25: ; preds = %2
store i32 0, i32* %11
br label %26
26: ; preds = %37, %25
%27 = load i32, i32* %11
%28 = sext i32 %27 to i64
%29 = load i64, i64* %10
%30 = icmp ult i64 %28, %29
br i1 %30, label %31, label %40
31: ; preds = %26
%32 = load i32, i32* %11
%33 = load i32*, i32** %8
%34 = load i32, i32* %11
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %33, i64 %35
store i32 %32, i32* %36
br label %37
37: ; preds = %31
%38 = load i32, i32* %11
%39 = add nsw i32 %38, 1
store i32 %39, i32* %11
br label %26
40: ; preds = %26
%41 = load i64, i64* %10
%42 = call i32* @malloc(i64 %41)
store i32* %42, i32** %9
%43 = load i32*, i32** %9
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %47
45: ; preds = %40
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %138
47: ; preds = %40
%48 = load i8*, i8** %7
%49 = load i32, i32* @O_RDWR
%50 = load i32, i32* @O_CREAT
%51 = or i32 %49, %50
%52 = load i32, i32* @O_TRUNC
%53 = or i32 %51, %52
%54 = call i32 @open(i8* %48, i32 %53)
store i32 %54, i32* %12
%55 = load i32, i32* %12
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %47
%58 = load i8*, i8** %7
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %58)
store i32 -1, i32* %3
br label %138
60: ; preds = %47
store i64 0, i64* %13
br label %61
61: ; preds = %84, %60
%62 = load i64, i64* %13
%63 = load i64, i64* %6
%64 = icmp ult i64 %62, %63
br i1 %64, label %65, label %87
65: ; preds = %61
%66 = load i64, i64* %13
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i64 %66)
%68 = load i32, i32* @stdout
%69 = call i32 @fflush(i32 %68)
%70 = load i32, i32* %12
%71 = load i32*, i32** %8
%72 = load i64, i64* %10
%73 = call i32 @write(i32 %70, i32* %71, i64 %72)
store i32 %73, i32* %14
%74 = load i32, i32* %14
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %65
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
br label %138
78: ; preds = %65
%79 = load i64, i64* %10
%80 = load i64, i64* %13
%81 = add i64 %80, %79
store i64 %81, i64* %13
%82 = load i32, i32* %12
%83 = call i32 @fsync(i32 %82)
br label %84
84: ; preds = %78
%85 = load i64, i64* %13
%86 = add i64 %85, 1
store i64 %86, i64* %13
br label %61
87: ; preds = %61
%88 = load i32, i32* %12
%89 = call i32 @close(i32 %88)
%90 = load i8*, i8** %7
%91 = load i32, i32* @O_RDONLY
%92 = call i32 @open(i8* %90, i32 %91)
store i32 %92, i32* %12
%93 = load i32, i32* %12
%94 = icmp slt i32 %93, 0
br i1 %94, label %95, label %97
95: ; preds = %87
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %3
br label %138
97: ; preds = %87
store i64 0, i64* %15
br label %98
98: ; preds = %127, %97
%99 = load i64, i64* %15
%100 = load i64, i64* %6
%101 = icmp ult i64 %99, %100
br i1 %101, label %102, label %130
102: ; preds = %98
%103 = load i64, i64* %15
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i64 %103)
%105 = load i32, i32* @stdout
%106 = call i32 @fflush(i32 %105)
%107 = load i32, i32* %12
%108 = load i32*, i32** %9
%109 = load i64, i64* %10
%110 = call i32 @read(i32 %107, i32* %108, i64 %109)
store i32 %110, i32* %16
%111 = load i32, i32* %16
%112 = icmp slt i32 %111, 0
br i1 %112, label %113, label %115
113: ; preds = %102
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
store i32 -1, i32* %3
br label %138
115: ; preds = %102
%116 = load i64, i64* %10
%117 = load i64, i64* %15
%118 = add i64 %117, %116
store i64 %118, i64* %15
%119 = load i32*, i32** %8
%120 = load i32*, i32** %9
%121 = load i64, i64* %10
%122 = call i64 @memcmp(i32* %119, i32* %120, i64 %121)
%123 = icmp ne i64 %122, 0
br i1 %123, label %124, label %126
124: ; preds = %115
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
store i32 -1, i32* %3
br label %138
126: ; preds = %115
br label %127
127: ; preds = %126
%128 = load i64, i64* %15
%129 = add i64 %128, 1
store i64 %129, i64* %15
br label %98
130: ; preds = %98
%131 = load i32, i32* %12
%132 = call i32 @close(i32 %131)
%133 = load i32*, i32** %8
%134 = call i32 @free(i32* %133)
%135 = load i32*, i32** %9
%136 = call i32 @free(i32* %135)
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %3
br label %138
138: ; preds = %130, %124, %113, %95, %76, %57, %45, %23
%139 = load i32, i32* %3
ret i32 %139
}

LLVM IR (-O2):
@.str = [9 x i8] c"file_big\00"
@.str.1 = [13 x i8] c"size = %llu\0A\00"
@.str.2 = [19 x i8] c"mallco failed: %m\0A\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.3 = [31 x i8] c" open %s for read failed: %m\0A\00"
@.str.4 = [18 x i8] c"writen %lld Byte\0D\00"
@stdout = global i32 0
@.str.5 = [20 x i8] c"\0A write error: %m\0A\00"
@O_RDONLY = global i32 0
@.str.6 = [26 x i8] c"open for read failed: %m\0A\00"
@.str.7 = [16 x i8] c"read %lld Byte\0D\00"
@.str.8 = [18 x i8] c"\0A read error: %m\0A\00"
@str = [16 x i8] c" compare failed\00"
define i32 @big_file_test(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i64 6442450944)
%4 = tail call i32* @malloc(i64 524288)
%5 = icmp eq i32* %4, null
br i1 %5, label %38, label %6
6: ; preds = %2, %6
%7 = phi i64 [ %35, %6 ], [ 0, %2 ]
%8 = phi <4 x i32> [ %36, %6 ], [ <i32 0, i32 1, i32 2, i32 3>, %2 ]
%9 = add <4 x i32> %8, <i32 4, i32 4, i32 4, i32 4>
%10 = getelementptr inbounds i32, i32* %4, i64 %7
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> %8, <4 x i32>* %11
%12 = getelementptr inbounds i32, i32* %10, i64 4
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> %9, <4 x i32>* %13
%14 = or i64 %7, 8
%15 = add <4 x i32> %8, <i32 8, i32 8, i32 8, i32 8>
%16 = add <4 x i32> %8, <i32 12, i32 12, i32 12, i32 12>
%17 = getelementptr inbounds i32, i32* %4, i64 %14
%18 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> %15, <4 x i32>* %18
%19 = getelementptr inbounds i32, i32* %17, i64 4
%20 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> %16, <4 x i32>* %20
%21 = or i64 %7, 16
%22 = add <4 x i32> %8, <i32 16, i32 16, i32 16, i32 16>
%23 = add <4 x i32> %8, <i32 20, i32 20, i32 20, i32 20>
%24 = getelementptr inbounds i32, i32* %4, i64 %21
%25 = bitcast i32* %24 to <4 x i32>*
store <4 x i32> %22, <4 x i32>* %25
%26 = getelementptr inbounds i32, i32* %24, i64 4
%27 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> %23, <4 x i32>* %27
%28 = or i64 %7, 24
%29 = add <4 x i32> %8, <i32 24, i32 24, i32 24, i32 24>
%30 = add <4 x i32> %8, <i32 28, i32 28, i32 28, i32 28>
%31 = getelementptr inbounds i32, i32* %4, i64 %28
%32 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> %29, <4 x i32>* %32
%33 = getelementptr inbounds i32, i32* %31, i64 4
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> %30, <4 x i32>* %34
%35 = add nuw nsw i64 %7, 32
%36 = add <4 x i32> %8, <i32 32, i32 32, i32 32, i32 32>
%37 = icmp eq i64 %35, 524288
br i1 %37, label %40, label %6
38: ; preds = %2
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %97
40: ; preds = %6
%41 = tail call i32* @malloc(i64 524288)
%42 = icmp eq i32* %41, null
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %97
45: ; preds = %40
%46 = load i32, i32* @O_RDWR
%47 = load i32, i32* @O_CREAT
%48 = or i32 %47, %46
%49 = load i32, i32* @O_TRUNC
%50 = or i32 %48, %49
%51 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %50)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %45
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %97
55: ; preds = %45, %62
%56 = phi i64 [ %64, %62 ], [ 0, %45 ]
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i64 %56)
%58 = load i32, i32* @stdout
%59 = tail call i32 @fflush(i32 %58)
%60 = tail call i32 @write(i32 %51, i32* %4, i64 524288)
%61 = icmp slt i32 %60, 0
br i1 %61, label %66, label %62
62: ; preds = %55
%63 = tail call i32 @fsync(i32 %51)
%64 = add nuw nsw i64 %56, 524289
%65 = icmp ult i64 %56, 6441926655
br i1 %65, label %55, label %68
66: ; preds = %55
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %97
68: ; preds = %62
%69 = tail call i32 @close(i32 %51)
%70 = load i32, i32* @O_RDONLY
%71 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %70)
%72 = icmp slt i32 %71, 0
br i1 %72, label %73, label %78
73: ; preds = %68
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %97
75: ; preds = %87
%76 = add nuw nsw i64 %79, 524289
%77 = icmp ult i64 %79, 6441926655
br i1 %77, label %78, label %92
78: ; preds = %68, %75
%79 = phi i64 [ %76, %75 ], [ 0, %68 ]
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i64 %79)
%81 = load i32, i32* @stdout
%82 = tail call i32 @fflush(i32 %81)
%83 = tail call i32 @read(i32 %71, i32* %41, i64 524288)
%84 = icmp slt i32 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %78
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
br label %97
87: ; preds = %78
%88 = tail call i64 @memcmp(i32* %4, i32* %41, i64 524288)
%89 = icmp eq i64 %88, 0
br i1 %89, label %75, label %90
90: ; preds = %87
%91 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %97
92: ; preds = %75
%93 = tail call i32 @close(i32 %71)
%94 = tail call i32 @free(i32* %4)
%95 = tail call i32 @free(i32* %41)
%96 = tail call i32 @putchar(i32 10)
br label %97
97: ; preds = %85, %90, %66, %53, %73, %92, %43, %38
%98 = phi i32 [ -1, %38 ], [ -1, %43 ], [ -1, %53 ], [ -1, %73 ], [ 0, %92 ], [ -1, %66 ], [ -1, %90 ], [ -1, %85 ]
ret i32 %98
}