#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 */

/* Variables and functions */
int maxbottom();
int maxdiag1();
int maxdiag2();
int maxleft();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int diag1, diag2, bottom, left;
  diag1 = maxdiag1();
  diag2 = maxdiag2();
  bottom = maxbottom();
  left = maxleft();
  printf("%d\n",
         ((diag2) > (((diag1) > (((bottom) > (left) ? (bottom) : (left)))
                          ? (diag1)
                          : (((bottom) > (left) ? (bottom) : (left)))))
              ? (diag2)
              : (((diag1) > (((bottom) > (left) ? (bottom) : (left)))
                      ? (diag1)
                      : (((bottom) > (left) ? (bottom) : (left)))))));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <maxdiag1@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <maxdiag2@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <maxbottom@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1060 <maxleft@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    11b1 <main+0x61>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    11b7 <main+0x67>
mov    -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x2c(%rbp),%ecx
cmp    %ecx,%eax
jle    11d0 <main+0x80>
mov    -0x14(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    11f3 <main+0xa3>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    11e7 <main+0x97>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    11ed <main+0x9d>
mov    -0x20(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x30(%rbp),%ecx
cmp    %ecx,%eax
jle    120c <main+0xbc>
mov    -0x18(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    1271 <main+0x121>
mov    -0x14(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1229 <main+0xd9>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    122f <main+0xdf>
mov    -0x20(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x40(%rbp),%ecx
cmp    %ecx,%eax
jle    1248 <main+0xf8>
mov    -0x14(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    126b <main+0x11b>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    125f <main+0x10f>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x48(%rbp)
jmp    1265 <main+0x115>
mov    -0x20(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%esi
lea    0xd85(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1070 <maxdiag1@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1030 <maxdiag2@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <maxbottom@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <maxleft@plt>
cmp    %eax,%ebx
cmovle %eax,%ebx
cmp    %ebx,%r14d
cmovg  %r14d,%ebx
cmp    %ebx,%ebp
cmovg  %ebp,%ebx
lea    0xe71(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (...) @maxdiag1()
store i32 %10, i32* %6
%11 = call i32 (...) @maxdiag2()
store i32 %11, i32* %7
%12 = call i32 (...) @maxbottom()
store i32 %12, i32* %8
%13 = call i32 (...) @maxleft()
store i32 %13, i32* %9
%14 = load i32, i32* %7
%15 = load i32, i32* %6
%16 = load i32, i32* %8
%17 = load i32, i32* %9
%18 = icmp sgt i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = load i32, i32* %8
br label %23
21: ; preds = %2
%22 = load i32, i32* %9
br label %23
23: ; preds = %21, %19
%24 = phi i32 [ %20, %19 ], [ %22, %21 ]
%25 = icmp sgt i32 %15, %24
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = load i32, i32* %6
br label %38
28: ; preds = %23
%29 = load i32, i32* %8
%30 = load i32, i32* %9
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = load i32, i32* %8
br label %36
34: ; preds = %28
%35 = load i32, i32* %9
br label %36
36: ; preds = %34, %32
%37 = phi i32 [ %33, %32 ], [ %35, %34 ]
br label %38
38: ; preds = %36, %26
%39 = phi i32 [ %27, %26 ], [ %37, %36 ]
%40 = icmp sgt i32 %14, %39
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = load i32, i32* %7
br label %69
43: ; preds = %38
%44 = load i32, i32* %6
%45 = load i32, i32* %8
%46 = load i32, i32* %9
%47 = icmp sgt i32 %45, %46
br i1 %47, label %48, label %50
48: ; preds = %43
%49 = load i32, i32* %8
br label %52
50: ; preds = %43
%51 = load i32, i32* %9
br label %52
52: ; preds = %50, %48
%53 = phi i32 [ %49, %48 ], [ %51, %50 ]
%54 = icmp sgt i32 %44, %53
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = load i32, i32* %6
br label %67
57: ; preds = %52
%58 = load i32, i32* %8
%59 = load i32, i32* %9
%60 = icmp sgt i32 %58, %59
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = load i32, i32* %8
br label %65
63: ; preds = %57
%64 = load i32, i32* %9
br label %65
65: ; preds = %63, %61
%66 = phi i32 [ %62, %61 ], [ %64, %63 ]
br label %67
67: ; preds = %65, %55
%68 = phi i32 [ %56, %55 ], [ %66, %65 ]
br label %69
69: ; preds = %67, %41
%70 = phi i32 [ %42, %41 ], [ %68, %67 ]
%71 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %70)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @maxdiag1()
%4 = tail call i32 (...) @maxdiag2()
%5 = tail call i32 (...) @maxbottom()
%6 = tail call i32 (...) @maxleft()
%7 = icmp sgt i32 %5, %6
%8 = select i1 %7, i32 %5, i32 %6
%9 = icmp sgt i32 %3, %8
%10 = select i1 %9, i32 %3, i32 %8
%11 = icmp sgt i32 %4, %10
%12 = select i1 %11, i32 %4, i32 %10
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}