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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
void createFourFile() {
  FILE *file1;
  FILE *file2;
  FILE *file3;
  FILE *file4;
  FILE *file5;
  FILE *file6;
  FILE *file7;
  FILE *file8;
  file1 = fopen("./test_file1", "w+");
  file2 = fopen("./test_file2", "w+");
  file3 = fopen("./test_file3", "w+");
  file4 = fopen("./test_file4", "w+");
  file5 = fopen("./test_file5", "w+");
  file6 = fopen("./test_file6", "w+");
  file7 = fopen("./test_file7", "w+");
  file8 = fopen("./test_file8", "w+");
  int size = 5000000;
  while (size > 0) {
    fputc('a', file1);
    fputc('a', file2);
    fputc('a', file3);
    fputc('a', file4);
    fputc('a', file5);
    fputc('a', file6);
    fputc('a', file7);
    fputc('a', file8);
    size--;
  }
  fclose(file1);
  fclose(file2);
  fclose(file3);
  fclose(file4);
  fclose(file5);
  fclose(file6);
  fclose(file7);
  fclose(file8);
  printf("NOTE: test_files have been created!\n");
  return;
}


x86 assembly (clang, -O0):
<createFourFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xea0(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xea0(%rip),%rdi
lea    0xe89(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe96(%rip),%rdi
lea    0xe72(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
lea    0xe8c(%rip),%rdi
lea    0xe5b(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x28(%rbp)
lea    0xe82(%rip),%rdi
lea    0xe44(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x30(%rbp)
lea    0xe78(%rip),%rdi
lea    0xe2d(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x38(%rbp)
lea    0xe6e(%rip),%rdi
lea    0xe16(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x40(%rbp)
movl   $0x4c4b40,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jle    128f <createFourFile+0x14f>
mov    -0x8(%rbp),%rsi
mov    $0x61,%edi
call   1050 <fputc@plt>
mov    -0x10(%rbp),%rsi
mov    $0x61,%edi
call   1050 <fputc@plt>
mov    -0x18(%rbp),%rsi
mov    $0x61,%edi
call   1050 <fputc@plt>
mov    -0x20(%rbp),%rsi
mov    $0x61,%edi
call   1050 <fputc@plt>
mov    -0x28(%rbp),%rsi
mov    $0x61,%edi
call   1050 <fputc@plt>
mov    -0x30(%rbp),%rsi
mov    $0x61,%edi
call   1050 <fputc@plt>
mov    -0x38(%rbp),%rsi
mov    $0x61,%edi
call   1050 <fputc@plt>
mov    -0x40(%rbp),%rsi
mov    $0x61,%edi
call   1050 <fputc@plt>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
jmp    1207 <createFourFile+0xc7>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xd8d(%rip),%rdi
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createFourFile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeab(%rip),%rdi
lea    0xeb1(%rip),%r15
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,0x10(%rsp)
lea    0xea0(%rip),%rdi
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,0x8(%rsp)
lea    0xe99(%rip),%rdi
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,(%rsp)
lea    0xe93(%rip),%rdi
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,%r13
lea    0xe8e(%rip),%rdi
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xe89(%rip),%rdi
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,%rbp
lea    0xe84(%rip),%rdi
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
lea    0xe7f(%rip),%rdi
mov    %r15,%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
mov    $0x4c4b41,%r12d
mov    $0x61,%edi
mov    0x10(%rsp),%rsi
call   1050 <fputc@plt>
mov    $0x61,%edi
mov    0x8(%rsp),%rsi
call   1050 <fputc@plt>
mov    $0x61,%edi
mov    (%rsp),%rsi
call   1050 <fputc@plt>
mov    $0x61,%edi
mov    %r13,%rsi
call   1050 <fputc@plt>
mov    $0x61,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
mov    $0x61,%edi
mov    %rbp,%rsi
call   1050 <fputc@plt>
mov    $0x61,%edi
mov    %r14,%rsi
call   1050 <fputc@plt>
mov    $0x61,%edi
mov    %r15,%rsi
call   1050 <fputc@plt>
add    $0xffffffff,%r12d
cmp    $0x1,%r12d
ja     11f0 <createFourFile+0xb0>
mov    0x10(%rsp),%rdi
call   1040 <fclose@plt>
mov    0x8(%rsp),%rdi
call   1040 <fclose@plt>
mov    (%rsp),%rdi
call   1040 <fclose@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xdb8(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"./test_file1\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [13 x i8] c"./test_file2\00"
@.str.3 = [13 x i8] c"./test_file3\00"
@.str.4 = [13 x i8] c"./test_file4\00"
@.str.5 = [13 x i8] c"./test_file5\00"
@.str.6 = [13 x i8] c"./test_file6\00"
@.str.7 = [13 x i8] c"./test_file7\00"
@.str.8 = [13 x i8] c"./test_file8\00"
@.str.9 = [37 x i8] c"NOTE: test_files have been created!\0A\00"
define void @createFourFile() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %1
%11 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %2
%12 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %3
%13 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %13, i32** %4
%14 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %14, i32** %5
%15 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %6
%16 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %7
%17 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %8
store i32 5000000, i32* %9
br label %18
18: ; preds = %21, %0
%19 = load i32, i32* %9
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %40
21: ; preds = %18
%22 = load i32*, i32** %1
%23 = call i32 @fputc(i8 signext 97, i32* %22)
%24 = load i32*, i32** %2
%25 = call i32 @fputc(i8 signext 97, i32* %24)
%26 = load i32*, i32** %3
%27 = call i32 @fputc(i8 signext 97, i32* %26)
%28 = load i32*, i32** %4
%29 = call i32 @fputc(i8 signext 97, i32* %28)
%30 = load i32*, i32** %5
%31 = call i32 @fputc(i8 signext 97, i32* %30)
%32 = load i32*, i32** %6
%33 = call i32 @fputc(i8 signext 97, i32* %32)
%34 = load i32*, i32** %7
%35 = call i32 @fputc(i8 signext 97, i32* %34)
%36 = load i32*, i32** %8
%37 = call i32 @fputc(i8 signext 97, i32* %36)
%38 = load i32, i32* %9
%39 = add nsw i32 %38, -1
store i32 %39, i32* %9
br label %18
40: ; preds = %18
%41 = load i32*, i32** %1
%42 = call i32 @fclose(i32* %41)
%43 = load i32*, i32** %2
%44 = call i32 @fclose(i32* %43)
%45 = load i32*, i32** %3
%46 = call i32 @fclose(i32* %45)
%47 = load i32*, i32** %4
%48 = call i32 @fclose(i32* %47)
%49 = load i32*, i32** %5
%50 = call i32 @fclose(i32* %49)
%51 = load i32*, i32** %6
%52 = call i32 @fclose(i32* %51)
%53 = load i32*, i32** %7
%54 = call i32 @fclose(i32* %53)
%55 = load i32*, i32** %8
%56 = call i32 @fclose(i32* %55)
%57 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"./test_file1\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [13 x i8] c"./test_file2\00"
@.str.3 = [13 x i8] c"./test_file3\00"
@.str.4 = [13 x i8] c"./test_file4\00"
@.str.5 = [13 x i8] c"./test_file5\00"
@.str.6 = [13 x i8] c"./test_file6\00"
@.str.7 = [13 x i8] c"./test_file7\00"
@.str.8 = [13 x i8] c"./test_file8\00"
@str = [36 x i8] c"NOTE: test_files have been created!\00"
define void @createFourFile() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %0, %9
%10 = phi i32 [ 5000000, %0 ], [ %19, %9 ]
%11 = tail call i32 @fputc(i8 signext 97, i32* %1)
%12 = tail call i32 @fputc(i8 signext 97, i32* %2)
%13 = tail call i32 @fputc(i8 signext 97, i32* %3)
%14 = tail call i32 @fputc(i8 signext 97, i32* %4)
%15 = tail call i32 @fputc(i8 signext 97, i32* %5)
%16 = tail call i32 @fputc(i8 signext 97, i32* %6)
%17 = tail call i32 @fputc(i8 signext 97, i32* %7)
%18 = tail call i32 @fputc(i8 signext 97, i32* %8)
%19 = add nsw i32 %10, -1
%20 = icmp ugt i32 %10, 1
br i1 %20, label %9, label %21
21: ; preds = %9
%22 = tail call i32 @fclose(i32* %1)
%23 = tail call i32 @fclose(i32* %2)
%24 = tail call i32 @fclose(i32* %3)
%25 = tail call i32 @fclose(i32* %4)
%26 = tail call i32 @fclose(i32* %5)
%27 = tail call i32 @fclose(i32* %6)
%28 = tail call i32 @fclose(i32* %7)
%29 = tail call i32 @fclose(i32* %8)
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret void
}