#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*/ *Fopen(char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, double);
int fscanf(int /*<<< orphan*/ *, char *, double *);
int /*<<< orphan*/ stdout;
int MaxFile(char *fn1, char *fn2) {
  FILE *F1 = Fopen(fn1, "r"), *F2 = Fopen(fn2, "r");
  double max1, max2;
  while (fscanf(F1, "%lf", &max1) == 1 && fscanf(F2, "%lf", &max2) == 1)
    fprintf(stdout, "%lf\n", max1 > max2 ? max1 : max2);
  if (F1)
    fclose(F1);
  if (F2)
    fclose(F2);
  return 0;
}


x86 assembly (clang, -O0):
<MaxFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1060 <Fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1060 <Fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe7f(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <fscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x31(%rbp)
jne    11b9 <MaxFile+0x79>
mov    -0x20(%rbp),%rdi
lea    0xe5b(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <fscanf@plt>
cmp    $0x1,%eax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    11c9 <MaxFile+0x89>
jmp    1217 <MaxFile+0xd7>
mov    0x2e10(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    11f4 <MaxFile+0xb4>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11fe <MaxFile+0xbe>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x38(%rbp),%edi
movsd  -0x40(%rbp),%xmm0
lea    0xdf9(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1178 <MaxFile+0x38>
cmpq   $0x0,-0x18(%rbp)
je     122b <MaxFile+0xeb>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
cmpq   $0x0,-0x20(%rbp)
je     123f <MaxFile+0xff>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MaxFile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
lea    0xea8(%rip),%rbp
mov    %rbp,%rsi
call   1060 <Fopen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <Fopen@plt>
mov    %rax,%r14
lea    0xe8a(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %r15,%rdi
call   1040 <fscanf@plt>
cmp    $0x1,%eax
jne    11f3 <MaxFile+0xb3>
lea    0xe71(%rip),%rbx
lea    0x10(%rsp),%r12
lea    0xe69(%rip),%r13
lea    0x8(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1040 <fscanf@plt>
cmp    $0x1,%eax
jne    11f3 <MaxFile+0xb3>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
movsd  0x8(%rsp),%xmm0
maxsd  0x10(%rsp),%xmm0
mov    %r13,%rsi
call   1050 <fprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1040 <fscanf@plt>
cmp    $0x1,%eax
je     11b0 <MaxFile+0x70>
test   %r15,%r15
je     1200 <MaxFile+0xc0>
mov    %r15,%rdi
call   1030 <fclose@plt>
test   %r14,%r14
je     120d <MaxFile+0xcd>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [4 x i8] c"%lf\00"
@stdout = global i32 0
@.str.2 = [5 x i8] c"%lf\0A\00"
define i32 @MaxFile(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca double
%8 = alloca double
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = call i32* @Fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %5
%11 = load i8*, i8** %4
%12 = call i32* @Fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %6
br label %13
13: ; preds = %32, %2
%14 = load i32*, i32** %5
%15 = call i32 @fscanf(i32* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %7)
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i32*, i32** %6
%19 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %8)
%20 = icmp eq i32 %19, 1
br label %21
21: ; preds = %17, %13
%22 = phi i1 [ false, %13 ], [ %20, %17 ]
br i1 %22, label %23, label %35
23: ; preds = %21
%24 = load i32, i32* @stdout
%25 = load double, double* %7
%26 = load double, double* %8
%27 = fcmp ogt double %25, %26
br i1 %27, label %28, label %30
28: ; preds = %23
%29 = load double, double* %7
br label %32
30: ; preds = %23
%31 = load double, double* %8
br label %32
32: ; preds = %30, %28
%33 = phi double [ %29, %28 ], [ %31, %30 ]
%34 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %33)
br label %13
35: ; preds = %21
%36 = load i32*, i32** %5
%37 = icmp ne i32* %36, null
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = load i32*, i32** %5
%40 = call i32 @fclose(i32* %39)
br label %41
41: ; preds = %38, %35
%42 = load i32*, i32** %6
%43 = icmp ne i32* %42, null
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = load i32*, i32** %6
%46 = call i32 @fclose(i32* %45)
br label %47
47: ; preds = %44, %41
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [4 x i8] c"%lf\00"
@stdout = global i32 0
@.str.2 = [5 x i8] c"%lf\0A\00"
define i32 @MaxFile(i8* %0, i8* %1) {
%3 = alloca double
%4 = alloca double
%5 = tail call i32* @Fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32* @Fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %23
11: ; preds = %2, %14
%12 = call i32 @fscanf(i32* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %4)
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = load i32, i32* @stdout
%16 = load double, double* %3
%17 = load double, double* %4
%18 = fcmp ogt double %16, %17
%19 = select i1 %18, double %16, double %17
%20 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %19)
%21 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%22 = icmp eq i32 %21, 1
br i1 %22, label %11, label %23
23: ; preds = %11, %14, %2
%24 = icmp eq i32* %5, null
br i1 %24, label %27, label %25
25: ; preds = %23
%26 = call i32 @fclose(i32* %5)
br label %27
27: ; preds = %25, %23
%28 = icmp eq i32* %6, null
br i1 %28, label %31, label %29
29: ; preds = %27
%30 = call i32 @fclose(i32* %6)
br label %31
31: ; preds = %29, %27
ret i32 0
}