#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 *, int, ...);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  FILE *fp;
  int i, j;
  fp = fopen("emp", "w");
  for (i = 0; i < 10; i++) {
    fprintf(fp, "%4d%4d\n", 0, -1);
    for (j = 0; j < 3; j++) {
      fprintf(fp, "%3d%10s%21s%10.2f\n", -1, "x", "x", 0.0);
    }
  }
  fclose(fp);
  fp = fopen("over", "w");
  fprintf(fp, "%4d\n", 0);
  fclose(fp);
  printf("Create complete.\n");
  scanf("%d", &i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe97(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11f6 <main+0xa6>
mov    -0x10(%rbp),%rdi
lea    0xe74(%rip),%rsi
xor    %edx,%edx
mov    $0xffffffff,%ecx
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    11e3 <main+0x93>
mov    -0x10(%rbp),%rdi
lea    0xe52(%rip),%rsi
mov    $0xffffffff,%edx
lea    0xe59(%rip),%r8
xorps  %xmm0,%xmm0
mov    %r8,%rcx
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a7 <main+0x57>
jmp    11e8 <main+0x98>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117d <main+0x2d>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe1d(%rip),%rdi
lea    0xdf7(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xde8(%rip),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xdee(%rip),%rdi
call   1040 <printf@plt>
lea    0xdf4(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe9d(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    $0xa,%ebp
lea    0xe88(%rip),%r14
lea    0xe89(%rip),%r15
lea    0xe95(%rip),%r12
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    $0xffffffff,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0xffffffff,%edx
mov    %r12,%rcx
mov    %r12,%r8
mov    $0x1,%al
call   1050 <fprintf@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0xffffffff,%edx
mov    %r12,%rcx
mov    %r12,%r8
mov    $0x1,%al
call   1050 <fprintf@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0xffffffff,%edx
mov    %r12,%rcx
mov    %r12,%r8
mov    $0x1,%al
call   1050 <fprintf@plt>
add    $0xffffffff,%ebp
jne    1190 <main+0x40>
movl   $0xa,0xc(%rsp)
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xe12(%rip),%rdi
lea    0xdec(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
lea    0xde2(%rip),%rsi
mov    %rax,%rdi
xor    %edx,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xde9(%rip),%rdi
call   1030 <puts@plt>
lea    0xdda(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"emp\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [8 x i8] c"%4d%4d\0A\00"
@.str.3 = [19 x i8] c"%3d%10s%21s%10.2f\0A\00"
@.str.4 = [2 x i8] c"x\00"
@.str.5 = [5 x i8] c"over\00"
@.str.6 = [5 x i8] c"%4d\0A\00"
@.str.7 = [18 x i8] c"Create complete.\0A\00"
@.str.8 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32* @fopen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %2
store i32 0, i32* %3
br label %6
6: ; preds = %22, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = load i32*, i32** %2
%11 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 -1)
store i32 0, i32* %4
br label %12
12: ; preds = %18, %9
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32*, i32** %2
%17 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), double 0.000000e+00)
br label %18
18: ; preds = %15
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %12
21: ; preds = %12
br label %22
22: ; preds = %21
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %6
25: ; preds = %6
%26 = load i32*, i32** %2
%27 = call i32 @fclose(i32* %26)
%28 = call i32* @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %28, i32** %2
%29 = load i32*, i32** %2
%30 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 0)
%31 = load i32*, i32** %2
%32 = call i32 @fclose(i32* %31)
%33 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %3)
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [4 x i8] c"emp\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [8 x i8] c"%4d%4d\0A\00"
@.str.3 = [19 x i8] c"%3d%10s%21s%10.2f\0A\00"
@.str.4 = [2 x i8] c"x\00"
@.str.5 = [5 x i8] c"over\00"
@.str.6 = [5 x i8] c"%4d\0A\00"
@.str.8 = [3 x i8] c"%d\00"
@str = [17 x i8] c"Create complete.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %4
4: ; preds = %0, %4
%5 = phi i32 [ 0, %0 ], [ %10, %4 ]
%6 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 -1)
%7 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), double 0.000000e+00)
%8 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), double 0.000000e+00)
%9 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 -1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), double 0.000000e+00)
%10 = add nuw nsw i32 %5, 1
%11 = icmp eq i32 %10, 10
br i1 %11, label %12, label %4
12: ; preds = %4
store i32 10, i32* %1
%13 = tail call i32 @fclose(i32* %3)
%14 = tail call i32* @fopen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 0)
%16 = tail call i32 @fclose(i32* %14)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %1)
ret i32 0
}