#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 charloc(char *, int);
int /*<<< orphan*/ checkVal(int *, int *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, 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 = charloc(first_line, 1);
  int high_x = charloc(second_line, 1);
  checkVal(&low_x, &high_x);
  if (charloc(first_line, 5) > charloc(second_line, 5)) {
    high_x = charloc(first_line, 5);
  } else {
    high_x = charloc(second_line, 5);
  }
  int low_y = charloc(first_line, 3);
  int high_y = charloc(second_line, 3);
  checkVal(&low_y, &high_y);
  if (charloc(first_line, 7) > charloc(second_line, 7)) {
    high_y = charloc(first_line, 7);
  } else {
    high_y = charloc(second_line, 7);
  }
  side = (high_x - low_x);
  if ((low_y + side) >= high_y) {
    area = side * side;
  } else {
    side = (high_y - low_y);
    area = side * side;
  }
  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    0xe8a(%rip),%rdi
lea    0xe8d(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <FLine@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <FLine@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x1,%esi
call   1050 <charloc@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x1,%esi
call   1050 <charloc@plt>
mov    %eax,-0x30(%rbp)
lea    -0x2c(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1080 <checkVal@plt>
mov    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <charloc@plt>
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x5,%esi
call   1050 <charloc@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
jle    1218 <main+0xb8>
mov    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <charloc@plt>
mov    %eax,-0x30(%rbp)
jmp    1229 <main+0xc9>
mov    -0x28(%rbp),%rdi
mov    $0x5,%esi
call   1050 <charloc@plt>
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x3,%esi
call   1050 <charloc@plt>
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x3,%esi
call   1050 <charloc@plt>
mov    %eax,-0x38(%rbp)
lea    -0x34(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1080 <checkVal@plt>
mov    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1050 <charloc@plt>
mov    %eax,-0x48(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x7,%esi
call   1050 <charloc@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
cmp    %ecx,%eax
jle    129a <main+0x13a>
mov    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1050 <charloc@plt>
mov    %eax,-0x38(%rbp)
jmp    12ab <main+0x14b>
mov    -0x28(%rbp),%rdi
mov    $0x7,%esi
call   1050 <charloc@plt>
mov    %eax,-0x38(%rbp)
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     12d2 <main+0x172>
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    12e5 <main+0x185>
mov    -0x38(%rbp),%eax
sub    -0x34(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    0xd20(%rip),%rdi
lea    0xd24(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xd0f(%rip),%rsi
call   1040 <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    0xe8f(%rip),%rdi
lea    0xe92(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1060 <FLine@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1060 <FLine@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    $0x1,%esi
call   1050 <charloc@plt>
mov    %eax,0x14(%rsp)
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <charloc@plt>
mov    %eax,0x8(%rsp)
lea    0x14(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1080 <checkVal@plt>
mov    %r15,%rdi
mov    $0x5,%esi
call   1050 <charloc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <charloc@plt>
cmp    %eax,%ebp
mov    %rbx,%rdi
cmovg  %r15,%rdi
mov    $0x5,%esi
call   1050 <charloc@plt>
mov    %eax,0x8(%rsp)
mov    %r15,%rdi
mov    $0x3,%esi
call   1050 <charloc@plt>
mov    %eax,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <charloc@plt>
mov    %eax,0xc(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1080 <checkVal@plt>
mov    %r15,%rdi
mov    $0x7,%esi
call   1050 <charloc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <charloc@plt>
cmp    %eax,%ebp
cmovg  %r15,%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <charloc@plt>
mov    %eax,0xc(%rsp)
mov    0x8(%rsp),%ecx
sub    0x14(%rsp),%ecx
mov    0x10(%rsp),%edx
lea    (%rdx,%rcx,1),%esi
imul   %ecx,%ecx
mov    %eax,%ebx
sub    %edx,%ebx
imul   %ebx,%ebx
cmp    %eax,%esi
cmovge %ecx,%ebx
lea    0xd89(%rip),%rdi
lea    0xd8d(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbp
lea    0xd80(%rip),%rsi
mov    %rax,%rdi
mov    %ebx,%edx
call   1040 <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"square.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [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 @charloc(i8* %17, i32 1)
store i32 %18, i32* %7
%19 = load i8*, i8** %6
%20 = call i32 @charloc(i8* %19, i32 1)
store i32 %20, i32* %8
%21 = call i32 @checkVal(i32* %7, i32* %8)
%22 = load i8*, i8** %5
%23 = call i32 @charloc(i8* %22, i32 5)
%24 = load i8*, i8** %6
%25 = call i32 @charloc(i8* %24, i32 5)
%26 = icmp sgt i32 %23, %25
br i1 %26, label %27, label %30
27: ; preds = %0
%28 = load i8*, i8** %5
%29 = call i32 @charloc(i8* %28, i32 5)
store i32 %29, i32* %8
br label %33
30: ; preds = %0
%31 = load i8*, i8** %6
%32 = call i32 @charloc(i8* %31, i32 5)
store i32 %32, i32* %8
br label %33
33: ; preds = %30, %27
%34 = load i8*, i8** %5
%35 = call i32 @charloc(i8* %34, i32 3)
store i32 %35, i32* %9
%36 = load i8*, i8** %6
%37 = call i32 @charloc(i8* %36, i32 3)
store i32 %37, i32* %10
%38 = call i32 @checkVal(i32* %9, i32* %10)
%39 = load i8*, i8** %5
%40 = call i32 @charloc(i8* %39, i32 7)
%41 = load i8*, i8** %6
%42 = call i32 @charloc(i8* %41, i32 7)
%43 = icmp sgt i32 %40, %42
br i1 %43, label %44, label %47
44: ; preds = %33
%45 = load i8*, i8** %5
%46 = call i32 @charloc(i8* %45, i32 7)
store i32 %46, i32* %10
br label %50
47: ; preds = %33
%48 = load i8*, i8** %6
%49 = call i32 @charloc(i8* %48, i32 7)
store i32 %49, i32* %10
br label %50
50: ; preds = %47, %44
%51 = load i32, i32* %8
%52 = load i32, i32* %7
%53 = sub nsw i32 %51, %52
store i32 %53, i32* %3
%54 = load i32, i32* %9
%55 = load i32, i32* %3
%56 = add nsw i32 %54, %55
%57 = load i32, i32* %10
%58 = icmp sge i32 %56, %57
br i1 %58, label %59, label %63
59: ; preds = %50
%60 = load i32, i32* %3
%61 = load i32, i32* %3
%62 = mul nsw i32 %60, %61
store i32 %62, i32* %4
br label %70
63: ; preds = %50
%64 = load i32, i32* %10
%65 = load i32, i32* %9
%66 = sub nsw i32 %64, %65
store i32 %66, i32* %3
%67 = load i32, i32* %3
%68 = load i32, i32* %3
%69 = mul nsw i32 %67, %68
store i32 %69, i32* %4
br label %70
70: ; preds = %63, %59
%71 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %71, i32** %11
%72 = load i32*, i32** %11
%73 = load i32, i32* %4
%74 = call i32 @fprintf(i32* %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %73)
%75 = load i32*, i32** %11
%76 = call i32 @fclose(i32* %75)
%77 = load i32*, i32** %2
%78 = call i32 @fclose(i32* %77)
%79 = load i32, i32* %1
ret i32 %79
}

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"square.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [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 @charloc(i8* %6, i32 1)
store i32 %9, i32* %1
%10 = bitcast i32* %2 to i8*
%11 = tail call i32 @charloc(i8* %7, i32 1)
store i32 %11, i32* %2
%12 = call i32 @checkVal(i32* %1, i32* %2)
%13 = call i32 @charloc(i8* %6, i32 5)
%14 = call i32 @charloc(i8* %7, i32 5)
%15 = icmp sgt i32 %13, %14
%16 = select i1 %15, i8* %6, i8* %7
%17 = call i32 @charloc(i8* %16, i32 5)
store i32 %17, i32* %2
%18 = bitcast i32* %3 to i8*
%19 = call i32 @charloc(i8* %6, i32 3)
store i32 %19, i32* %3
%20 = bitcast i32* %4 to i8*
%21 = call i32 @charloc(i8* %7, i32 3)
store i32 %21, i32* %4
%22 = call i32 @checkVal(i32* %3, i32* %4)
%23 = call i32 @charloc(i8* %6, i32 7)
%24 = call i32 @charloc(i8* %7, i32 7)
%25 = icmp sgt i32 %23, %24
%26 = select i1 %25, i8* %6, i8* %7
%27 = call i32 @charloc(i8* %26, i32 7)
store i32 %27, i32* %4
%28 = load i32, i32* %2
%29 = load i32, i32* %1
%30 = sub nsw i32 %28, %29
%31 = load i32, i32* %3
%32 = add nsw i32 %31, %30
%33 = icmp slt i32 %32, %27
%34 = mul nsw i32 %30, %30
%35 = sub nsw i32 %27, %31
%36 = mul nsw i32 %35, %35
%37 = select i1 %33, i32 %36, i32 %34
%38 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%39 = call i32 @fprintf(i32* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %37)
%40 = call i32 @fclose(i32* %38)
%41 = call i32 @fclose(i32* %5)
ret i32 0
}