#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 */
char *FLine(int /*<<< orphan*/ *);
int /*<<< orphan*/ checkVal(int *, int *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int intloc(char *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  FILE *file = fopen("square.in", "r");
  int side;
  int area = 0;
  char *first_line = FLine(file);
  char *second_line = FLine(file);
  int low_x = intloc(first_line, 1);
  int high_x = intloc(second_line, 1);
  checkVal(&low_x, &high_x);
  printf("Low_x: %d\n", low_x);
  if (intloc(first_line, 5) > intloc(second_line, 5)) {
    high_x = intloc(first_line, 5);
    printf("High x: %d\n", high_x);
  } else {
    high_x = intloc(second_line, 5);
    printf("High x: %d\n", high_x);
  }
  int low_y = intloc(first_line, 3);
  int high_y = intloc(second_line, 3);
  checkVal(&low_y, &high_y);
  printf("Low Y: %d\n", low_y);
  if (intloc(first_line, 7) > intloc(second_line, 7)) {
    high_y = intloc(first_line, 7);
    printf("High Y: %d\n", high_y);
  } else {
    high_y = intloc(second_line, 7);
    printf("High Y: %d\n", high_y);
  }
  side = (high_x - low_x);
  if ((low_y + side) >= high_y) {
    area = side * side;
    printf("%d\n", area);
  } else {
    side = (high_y - low_y);
    area = side * side;
    printf("%d\n", area);
  }
  FILE *fWrite = fopen("square.out", "w");
  fprintf(fWrite, "%d", area);
  fclose(fWrite);
  fclose(file);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
lea    0xe7d(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <FLine@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <FLine@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x1,%esi
call   1040 <intloc@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x1,%esi
call   1040 <intloc@plt>
mov    %eax,-0x30(%rbp)
lea    -0x2c(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1090 <checkVal@plt>
mov    -0x2c(%rbp),%esi
lea    0xe1c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <intloc@plt>
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x5,%esi
call   1040 <intloc@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
jle    1246 <main+0xd6>
mov    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <intloc@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
lea    0xddb(%rip),%rdi
call   1050 <printf@plt>
jmp    1266 <main+0xf6>
mov    -0x28(%rbp),%rdi
mov    $0x5,%esi
call   1040 <intloc@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
lea    0xdb6(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    $0x3,%esi
call   1040 <intloc@plt>
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x3,%esi
call   1040 <intloc@plt>
mov    %eax,-0x38(%rbp)
lea    -0x34(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1090 <checkVal@plt>
mov    -0x34(%rbp),%esi
lea    0xd84(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1040 <intloc@plt>
mov    %eax,-0x48(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x7,%esi
call   1040 <intloc@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
cmp    %ecx,%eax
jle    12f5 <main+0x185>
mov    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1040 <intloc@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%esi
lea    0xd43(%rip),%rdi
call   1050 <printf@plt>
jmp    1315 <main+0x1a5>
mov    -0x28(%rbp),%rdi
mov    $0x7,%esi
call   1040 <intloc@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%esi
lea    0xd1e(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%eax
sub    -0x2c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x34(%rbp),%eax
add    -0x14(%rbp),%eax
cmp    -0x38(%rbp),%eax
jl     134b <main+0x1db>
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xcf5(%rip),%rdi
call   1050 <printf@plt>
jmp    136d <main+0x1fd>
mov    -0x38(%rbp),%eax
sub    -0x34(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xcce(%rip),%rdi
call   1050 <printf@plt>
lea    0xcc6(%rip),%rdi
lea    0xcca(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xcb5(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe7f(%rip),%rdi
lea    0xe82(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1070 <FLine@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1070 <FLine@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    $0x1,%esi
call   1040 <intloc@plt>
mov    %eax,0x14(%rsp)
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <intloc@plt>
mov    %eax,0x10(%rsp)
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1090 <checkVal@plt>
mov    0x14(%rsp),%esi
lea    0xe2a(%rip),%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x5,%esi
call   1040 <intloc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <intloc@plt>
cmp    %eax,%ebp
mov    %rbx,%rdi
cmovg  %r15,%rdi
mov    $0x5,%esi
call   1040 <intloc@plt>
mov    %eax,0x10(%rsp)
lea    0xdf6(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x3,%esi
call   1040 <intloc@plt>
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <intloc@plt>
mov    %eax,0x8(%rsp)
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1090 <checkVal@plt>
mov    0xc(%rsp),%esi
lea    0xdbf(%rip),%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    $0x7,%esi
call   1040 <intloc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <intloc@plt>
cmp    %eax,%ebp
cmovg  %r15,%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <intloc@plt>
mov    %eax,0x8(%rsp)
lea    0xd8b(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    0x10(%rsp),%ebx
sub    0x14(%rsp),%ebx
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%ecx
mov    %ecx,%edx
sub    %eax,%edx
add    %ebx,%eax
imul   %edx,%edx
imul   %ebx,%ebx
cmp    %ecx,%eax
cmovl  %edx,%ebx
lea    0xd64(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
lea    0xd5a(%rip),%rdi
lea    0xd5e(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbp
lea    0xd51(%rip),%rsi
mov    %rax,%rdi
mov    %ebx,%edx
call   1060 <fprintf@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"square.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"Low_x: %d\0A\00"
@.str.3 = [12 x i8] c"High x: %d\0A\00"
@.str.4 = [11 x i8] c"Low Y: %d\0A\00"
@.str.5 = [12 x i8] c"High Y: %d\0A\00"
@.str.6 = [4 x i8] c"%d\0A\00"
@.str.7 = [11 x i8] c"square.out\00"
@.str.8 = [2 x i8] c"w\00"
@.str.9 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
store i32 0, i32* %1
%12 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %2
store i32 0, i32* %4
%13 = load i32*, i32** %2
%14 = call i8* @FLine(i32* %13)
store i8* %14, i8** %5
%15 = load i32*, i32** %2
%16 = call i8* @FLine(i32* %15)
store i8* %16, i8** %6
%17 = load i8*, i8** %5
%18 = call i32 @intloc(i8* %17, i32 1)
store i32 %18, i32* %7
%19 = load i8*, i8** %6
%20 = call i32 @intloc(i8* %19, i32 1)
store i32 %20, i32* %8
%21 = call i32 @checkVal(i32* %7, i32* %8)
%22 = load i32, i32* %7
%23 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = load i8*, i8** %5
%25 = call i32 @intloc(i8* %24, i32 5)
%26 = load i8*, i8** %6
%27 = call i32 @intloc(i8* %26, i32 5)
%28 = icmp sgt i32 %25, %27
br i1 %28, label %29, label %34
29: ; preds = %0
%30 = load i8*, i8** %5
%31 = call i32 @intloc(i8* %30, i32 5)
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %32)
br label %39
34: ; preds = %0
%35 = load i8*, i8** %6
%36 = call i32 @intloc(i8* %35, i32 5)
store i32 %36, i32* %8
%37 = load i32, i32* %8
%38 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %34, %29
%40 = load i8*, i8** %5
%41 = call i32 @intloc(i8* %40, i32 3)
store i32 %41, i32* %9
%42 = load i8*, i8** %6
%43 = call i32 @intloc(i8* %42, i32 3)
store i32 %43, i32* %10
%44 = call i32 @checkVal(i32* %9, i32* %10)
%45 = load i32, i32* %9
%46 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %45)
%47 = load i8*, i8** %5
%48 = call i32 @intloc(i8* %47, i32 7)
%49 = load i8*, i8** %6
%50 = call i32 @intloc(i8* %49, i32 7)
%51 = icmp sgt i32 %48, %50
br i1 %51, label %52, label %57
52: ; preds = %39
%53 = load i8*, i8** %5
%54 = call i32 @intloc(i8* %53, i32 7)
store i32 %54, i32* %10
%55 = load i32, i32* %10
%56 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %55)
br label %62
57: ; preds = %39
%58 = load i8*, i8** %6
%59 = call i32 @intloc(i8* %58, i32 7)
store i32 %59, i32* %10
%60 = load i32, i32* %10
%61 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %60)
br label %62
62: ; preds = %57, %52
%63 = load i32, i32* %8
%64 = load i32, i32* %7
%65 = sub nsw i32 %63, %64
store i32 %65, i32* %3
%66 = load i32, i32* %9
%67 = load i32, i32* %3
%68 = add nsw i32 %66, %67
%69 = load i32, i32* %10
%70 = icmp sge i32 %68, %69
br i1 %70, label %71, label %77
71: ; preds = %62
%72 = load i32, i32* %3
%73 = load i32, i32* %3
%74 = mul nsw i32 %72, %73
store i32 %74, i32* %4
%75 = load i32, i32* %4
%76 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %75)
br label %86
77: ; preds = %62
%78 = load i32, i32* %10
%79 = load i32, i32* %9
%80 = sub nsw i32 %78, %79
store i32 %80, i32* %3
%81 = load i32, i32* %3
%82 = load i32, i32* %3
%83 = mul nsw i32 %81, %82
store i32 %83, i32* %4
%84 = load i32, i32* %4
%85 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %84)
br label %86
86: ; preds = %77, %71
%87 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %87, i32** %11
%88 = load i32*, i32** %11
%89 = load i32, i32* %4
%90 = call i32 @fprintf(i32* %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %89)
%91 = load i32*, i32** %11
%92 = call i32 @fclose(i32* %91)
%93 = load i32*, i32** %2
%94 = call i32 @fclose(i32* %93)
%95 = load i32, i32* %1
ret i32 %95
}

LLVM IR (-O2):
@.str = [10 x i8] c"square.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"Low_x: %d\0A\00"
@.str.3 = [12 x i8] c"High x: %d\0A\00"
@.str.4 = [11 x i8] c"Low Y: %d\0A\00"
@.str.5 = [12 x i8] c"High Y: %d\0A\00"
@.str.6 = [4 x i8] c"%d\0A\00"
@.str.7 = [11 x i8] c"square.out\00"
@.str.8 = [2 x i8] c"w\00"
@.str.9 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i8* @FLine(i32* %5)
%7 = tail call i8* @FLine(i32* %5)
%8 = bitcast i32* %1 to i8*
%9 = tail call i32 @intloc(i8* %6, i32 1)
store i32 %9, i32* %1
%10 = bitcast i32* %2 to i8*
%11 = tail call i32 @intloc(i8* %7, i32 1)
store i32 %11, i32* %2
%12 = call i32 @checkVal(i32* %1, i32* %2)
%13 = load i32, i32* %1
%14 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = call i32 @intloc(i8* %6, i32 5)
%16 = call i32 @intloc(i8* %7, i32 5)
%17 = icmp sgt i32 %15, %16
%18 = select i1 %17, i8* %6, i8* %7
%19 = call i32 @intloc(i8* %18, i32 5)
store i32 %19, i32* %2
%20 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = bitcast i32* %3 to i8*
%22 = call i32 @intloc(i8* %6, i32 3)
store i32 %22, i32* %3
%23 = bitcast i32* %4 to i8*
%24 = call i32 @intloc(i8* %7, i32 3)
store i32 %24, i32* %4
%25 = call i32 @checkVal(i32* %3, i32* %4)
%26 = load i32, i32* %3
%27 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %26)
%28 = call i32 @intloc(i8* %6, i32 7)
%29 = call i32 @intloc(i8* %7, i32 7)
%30 = icmp sgt i32 %28, %29
%31 = select i1 %30, i8* %6, i8* %7
%32 = call i32 @intloc(i8* %31, i32 7)
store i32 %32, i32* %4
%33 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %2
%35 = load i32, i32* %1
%36 = sub nsw i32 %34, %35
%37 = load i32, i32* %3
%38 = add nsw i32 %37, %36
%39 = load i32, i32* %4
%40 = icmp slt i32 %38, %39
%41 = sub nsw i32 %39, %37
%42 = mul nsw i32 %41, %41
%43 = mul nsw i32 %36, %36
%44 = select i1 %40, i32 %42, i32 %43
%45 = select i1 %40, i32 %42, i32 %43
%46 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %44)
%47 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%48 = call i32 @fprintf(i32* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %45)
%49 = call i32 @fclose(i32* %47)
%50 = call i32 @fclose(i32* %5)
ret i32 0
}