#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*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ free(char *);
char *make_word(int);
int main() {
  FILE *f;
  int i;
  char *word;
  char *mean;
  f = fopen("dict.txt", "w");
  for (i = 0; i < 10000; i++) {
    word = make_word(3);
    mean = make_word(6);
    fprintf(f, "%s   %s\n", word, mean);
    free(word);
  }
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2710,-0x14(%rbp)
jge    11d5 <main+0x85>
mov    $0x3,%edi
call   1040 <make_word@plt>
mov    %rax,-0x20(%rbp)
mov    $0x6,%edi
call   1040 <make_word@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xe52(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117d <main+0x2d>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xea2(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r15
mov    $0x2710,%ebp
lea    0xe92(%rip),%r14
nopl   0x0(%rax)
mov    $0x3,%edi
call   1040 <make_word@plt>
mov    %rax,%rbx
mov    $0x6,%edi
call   1040 <make_word@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0xffffffff,%ebp
jne    1180 <main+0x30>
mov    %r15,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"dict.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [9 x i8] c"%s %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %2
store i32 0, i32* %3
br label %7
7: ; preds = %19, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 10000
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = call i8* @make_word(i32 3)
store i8* %11, i8** %4
%12 = call i8* @make_word(i32 6)
store i8* %12, i8** %5
%13 = load i32*, i32** %2
%14 = load i8*, i8** %4
%15 = load i8*, i8** %5
%16 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* %15)
%17 = load i8*, i8** %4
%18 = call i32 @free(i8* %17)
br label %19
19: ; preds = %10
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %7
22: ; preds = %7
%23 = load i32*, i32** %2
%24 = call i32 @fclose(i32* %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"dict.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [9 x i8] c"%s %s\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %8, %2 ]
%4 = tail call i8* @make_word(i32 3)
%5 = tail call i8* @make_word(i32 6)
%6 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %4, i8* %5)
%7 = tail call i32 @free(i8* %4)
%8 = add nuw nsw i32 %3, 1
%9 = icmp eq i32 %8, 10000
br i1 %9, label %10, label %2
10: ; preds = %2
%11 = tail call i32 @fclose(i32* %1)
ret i32 0
}