#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*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, float, float, float);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, float *, float *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  float r[300], s1[300], s2[300];
  int j;
  FILE *in_file, *out_file;
  if (argc < 4) {
    printf("USAGE: file.exe infile1 infile2 outfile\n");
    exit(1);
  };
  in_file = fopen(argv[1], "rt");
  for (j = 0; j < 300; j++)
    fscanf(in_file, "%f %f\n", &r[j], &s1[j]);
  fclose(in_file);
  in_file = fopen(argv[2], "rt");
  for (j = 0; j < 300; j++)
    fscanf(in_file, "%f %f\n", &r[j], &s2[j]);
  fclose(in_file);
  out_file = fopen(argv[3], "wt");
  for (j = 0; j < 300; j++)
    fprintf(out_file, "%f\t%f\t%f\n", r[j], s1[j], s2[j]);
  fclose(out_file);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1199 <main+0x39>
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe81(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0xe30(%rbp)
movl   $0x0,-0xe24(%rbp)
cmpl   $0x12c,-0xe24(%rbp)
jge    121f <main+0xbf>
mov    -0xe30(%rbp),%rdi
movslq -0xe24(%rbp),%rax
lea    -0x4c0(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
movslq -0xe24(%rbp),%rax
lea    -0x970(%rbp),%rcx
shl    $0x2,%rax
add    %rax,%rcx
lea    0xe26(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0xe24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe24(%rbp)
jmp    11be <main+0x5e>
mov    -0xe30(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdef(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0xe30(%rbp)
movl   $0x0,-0xe24(%rbp)
cmpl   $0x12c,-0xe24(%rbp)
jge    12b1 <main+0x151>
mov    -0xe30(%rbp),%rdi
movslq -0xe24(%rbp),%rax
lea    -0x4c0(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
movslq -0xe24(%rbp),%rax
lea    -0xe20(%rbp),%rcx
shl    $0x2,%rax
add    %rax,%rcx
lea    0xd94(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0xe24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe24(%rbp)
jmp    1250 <main+0xf0>
mov    -0xe30(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xd67(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0xe38(%rbp)
movl   $0x0,-0xe24(%rbp)
cmpl   $0x12c,-0xe24(%rbp)
jge    1349 <main+0x1e9>
mov    -0xe38(%rbp),%rdi
movslq -0xe24(%rbp),%rax
movss  -0x4c0(%rbp,%rax,4),%xmm0
ff ff
movslq -0xe24(%rbp),%rax
movss  -0x970(%rbp,%rax,4),%xmm1
ff ff
movslq -0xe24(%rbp),%rax
movss  -0xe20(%rbp,%rax,4),%xmm2
ff ff
lea    0xd06(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0xe24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe24(%rbp)
jmp    12e2 <main+0x182>
mov    -0xe38(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0xe40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xe18,%rsp
cmp    $0x3,%edi
jle    1288 <main+0x128>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe7b(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r12
xor    %ebx,%ebx
lea    0xe6d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
lea    (%rsp,%rbx,1),%rdx
lea    (%rsp,%rbx,1),%rcx
add    $0x960,%rcx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
add    $0x4,%rbx
cmp    $0x4b0,%rbx
jne    11a0 <main+0x40>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    0x10(%r14),%rdi
lea    0xe26(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r12
xor    %ebx,%ebx
lea    0xe18(%rip),%r15
nopl   0x0(%rax,%rax,1)
lea    (%rsp,%rbx,1),%rdx
lea    (%rsp,%rbx,1),%rcx
add    $0x4b0,%rcx
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <fscanf@plt>
add    $0x4,%rbx
cmp    $0x4b0,%rbx
jne    11f0 <main+0x90>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    0x18(%r14),%rdi
lea    0xde0(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r15
xor    %ebx,%ebx
lea    0xdd2(%rip),%r14
nopl   0x0(%rax,%rax,1)
movss  (%rsp,%rbx,4),%xmm0
movss  0x960(%rsp,%rbx,4),%xmm1
movss  0x4b0(%rsp,%rbx,4),%xmm2
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <fprintf@plt>
add    $0x1,%rbx
cmp    $0x12c,%rbx
jne    1240 <main+0xe0>
mov    %r15,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0xe18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xd88(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"USAGE: file.exe infile1 infile2 outfile\0A\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [7 x i8] c"%f %f\0A\00"
@.str.3 = [3 x i8] c"wt\00"
@.str.4 = [10 x i8] c"%f\09%f\09%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [300 x float]
%7 = alloca [300 x float]
%8 = alloca [300 x float]
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 4
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %10
store i32 0, i32* %9
br label %22
22: ; preds = %34, %17
%23 = load i32, i32* %9
%24 = icmp slt i32 %23, 300
br i1 %24, label %25, label %37
25: ; preds = %22
%26 = load i32*, i32** %10
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [300 x float], [300 x float]* %6, i64 0, i64 %28
%30 = load i32, i32* %9
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [300 x float], [300 x float]* %7, i64 0, i64 %31
%33 = call i32 @fscanf(i32* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float* %29, float* %32)
br label %34
34: ; preds = %25
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
store i32 %36, i32* %9
br label %22
37: ; preds = %22
%38 = load i32*, i32** %10
%39 = call i32 @fclose(i32* %38)
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = call i32* @fopen(i8* %42, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %43, i32** %10
store i32 0, i32* %9
br label %44
44: ; preds = %56, %37
%45 = load i32, i32* %9
%46 = icmp slt i32 %45, 300
br i1 %46, label %47, label %59
47: ; preds = %44
%48 = load i32*, i32** %10
%49 = load i32, i32* %9
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [300 x float], [300 x float]* %6, i64 0, i64 %50
%52 = load i32, i32* %9
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [300 x float], [300 x float]* %8, i64 0, i64 %53
%55 = call i32 @fscanf(i32* %48, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float* %51, float* %54)
br label %56
56: ; preds = %47
%57 = load i32, i32* %9
%58 = add nsw i32 %57, 1
store i32 %58, i32* %9
br label %44
59: ; preds = %44
%60 = load i32*, i32** %10
%61 = call i32 @fclose(i32* %60)
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 3
%64 = load i8*, i8** %63
%65 = call i32* @fopen(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %65, i32** %11
store i32 0, i32* %9
br label %66
66: ; preds = %84, %59
%67 = load i32, i32* %9
%68 = icmp slt i32 %67, 300
br i1 %68, label %69, label %87
69: ; preds = %66
%70 = load i32*, i32** %11
%71 = load i32, i32* %9
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [300 x float], [300 x float]* %6, i64 0, i64 %72
%74 = load float, float* %73
%75 = load i32, i32* %9
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [300 x float], [300 x float]* %7, i64 0, i64 %76
%78 = load float, float* %77
%79 = load i32, i32* %9
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [300 x float], [300 x float]* %8, i64 0, i64 %80
%82 = load float, float* %81
%83 = call i32 @fprintf(i32* %70, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), float %74, float %78, float %82)
br label %84
84: ; preds = %69
%85 = load i32, i32* %9
%86 = add nsw i32 %85, 1
store i32 %86, i32* %9
br label %66
87: ; preds = %66
%88 = load i32*, i32** %11
%89 = call i32 @fclose(i32* %88)
%90 = load i32, i32* %3
ret i32 %90
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [7 x i8] c"%f %f\0A\00"
@.str.3 = [3 x i8] c"wt\00"
@.str.4 = [10 x i8] c"%f\09%f\09%f\0A\00"
@str = [40 x i8] c"USAGE: file.exe infile1 infile2 outfile\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [300 x float]
%4 = alloca [300 x float]
%5 = alloca [300 x float]
%6 = bitcast [300 x float]* %3 to i8*
%7 = bitcast [300 x float]* %4 to i8*
%8 = bitcast [300 x float]* %5 to i8*
%9 = icmp slt i32 %0, 4
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %13, %17
%18 = phi i64 [ 0, %13 ], [ %22, %17 ]
%19 = getelementptr inbounds [300 x float], [300 x float]* %3, i64 0, i64 %18
%20 = getelementptr inbounds [300 x float], [300 x float]* %4, i64 0, i64 %18
%21 = call i32 @fscanf(i32* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float* %19, float* %20)
%22 = add nuw nsw i64 %18, 1
%23 = icmp eq i64 %22, 300
br i1 %23, label %24, label %17
24: ; preds = %17
%25 = call i32 @fclose(i32* %16)
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %24, %29
%30 = phi i64 [ 0, %24 ], [ %34, %29 ]
%31 = getelementptr inbounds [300 x float], [300 x float]* %3, i64 0, i64 %30
%32 = getelementptr inbounds [300 x float], [300 x float]* %5, i64 0, i64 %30
%33 = call i32 @fscanf(i32* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float* %31, float* %32)
%34 = add nuw nsw i64 %30, 1
%35 = icmp eq i64 %34, 300
br i1 %35, label %36, label %29
36: ; preds = %29
%37 = call i32 @fclose(i32* %28)
%38 = getelementptr inbounds i8*, i8** %1, i64 3
%39 = load i8*, i8** %38
%40 = call i32* @fopen(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %41
41: ; preds = %36, %41
%42 = phi i64 [ 0, %36 ], [ %50, %41 ]
%43 = getelementptr inbounds [300 x float], [300 x float]* %3, i64 0, i64 %42
%44 = load float, float* %43
%45 = getelementptr inbounds [300 x float], [300 x float]* %4, i64 0, i64 %42
%46 = load float, float* %45
%47 = getelementptr inbounds [300 x float], [300 x float]* %5, i64 0, i64 %42
%48 = load float, float* %47
%49 = call i32 @fprintf(i32* %40, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), float %44, float %46, float %48)
%50 = add nuw nsw i64 %42, 1
%51 = icmp eq i64 %50, 300
br i1 %51, label %52, label %41
52: ; preds = %41
%53 = call i32 @fclose(i32* %40)
ret i32 0
}