#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 max_area(int *, int);
int max_area_2(int *, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char const *argv[]) {
  int case1[] = {7, 1, 5, 9, 6, 7, 3};
  int case2[] = {1, 4, 4, 4, 4, 1, 1};
  int case3[] = {1, 8, 2, 2};
  printf("%d\n", max_area(case1, 7));
  printf("%d\n", max_area(case2, 7));
  printf("%d\n", max_area(case3, 4));
  printf("%d\n", max_area_2(case1, 7, 0, 6));
  printf("%d\n", max_area_2(case2, 7, 0, 6));
  printf("%d\n", max_area_2(case3, 4, 0, 3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeab(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xea9(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea1(%rip),%eax
mov    %eax,-0x38(%rbp)
mov    0xe9f(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe9c(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x7,%esi
call   1050 <max_area@plt>
mov    %eax,%esi
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x7,%esi
call   1050 <max_area@plt>
mov    %eax,%esi
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x4,%esi
call   1050 <max_area@plt>
mov    %eax,%esi
lea    0xe51(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x7,%esi
xor    %edx,%edx
mov    $0x6,%ecx
call   1030 <max_area_2@plt>
mov    %eax,%esi
lea    0xe2e(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x7,%esi
xor    %edx,%edx
mov    $0x6,%ecx
call   1030 <max_area_2@plt>
mov    %eax,%esi
lea    0xe0b(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x4,%esi
xor    %edx,%edx
mov    $0x3,%ecx
call   1030 <max_area_2@plt>
mov    %eax,%esi
lea    0xde8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
movups 0xeca(%rip),%xmm0
movups %xmm0,0x3c(%rsp)
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movups 0xed2(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xece(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x30(%rsp),%r15
mov    %r15,%rdi
mov    $0x7,%esi
call   1050 <max_area@plt>
lea    0xec1(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    $0x7,%esi
call   1050 <max_area@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x4,%esi
call   1050 <max_area@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    $0x7,%esi
xor    %edx,%edx
mov    $0x6,%ecx
call   1030 <max_area_2@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    $0x7,%esi
xor    %edx,%edx
mov    $0x6,%ecx
call   1030 <max_area_2@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
xor    %edx,%edx
mov    $0x3,%ecx
call   1030 <max_area_2@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.case1 = [7 x i32] [i32 7, i32 1, i32 5, i32 9, i32 6, i32 7, i32 3]
@__const.main.case2 = [7 x i32] [i32 1, i32 4, i32 4, i32 4, i32 4, i32 1, i32 1]
@__const.main.case3 = [4 x i32] [i32 1, i32 8, i32 2, i32 2]
@.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 [7 x i32]
%7 = alloca [7 x i32]
%8 = alloca [4 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [7 x i32]* %6 to i8*
%10 = bitcast [7 x i32]* %7 to i8*
%11 = bitcast [4 x i32]* %8 to i8*
%12 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%13 = call i32 @max_area(i32* %12, i32 7)
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [7 x i32], [7 x i32]* %7, i64 0, i64 0
%16 = call i32 @max_area(i32* %15, i32 7)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
%19 = call i32 @max_area(i32* %18, i32 4)
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%22 = call i32 @max_area_2(i32* %21, i32 7, i32 0, i32 6)
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds [7 x i32], [7 x i32]* %7, i64 0, i64 0
%25 = call i32 @max_area_2(i32* %24, i32 7, i32 0, i32 6)
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds [4 x i32], [4 x i32]* %8, i64 0, i64 0
%28 = call i32 @max_area_2(i32* %27, i32 4, i32 0, i32 3)
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
ret i32 0
}

LLVM IR (-O2):
@__const.main.case1 = [7 x i32] [i32 7, i32 1, i32 5, i32 9, i32 6, i32 7, i32 3]
@__const.main.case2 = [7 x i32] [i32 1, i32 4, i32 4, i32 4, i32 4, i32 1, i32 1]
@__const.main.case3 = [4 x i32] [i32 1, i32 8, i32 2, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [7 x i32]
%4 = alloca [7 x i32]
%5 = alloca [4 x i32]
%6 = bitcast [7 x i32]* %3 to i8*
%7 = bitcast [7 x i32]* %4 to i8*
%8 = bitcast [4 x i32]* %5 to i8*
%9 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%10 = call i32 @max_area(i32* %9, i32 7)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 0
%13 = call i32 @max_area(i32* %12, i32 7)
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%16 = call i32 @max_area(i32* %15, i32 4)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = call i32 @max_area_2(i32* %9, i32 7, i32 0, i32 6)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = call i32 @max_area_2(i32* %12, i32 7, i32 0, i32 6)
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = call i32 @max_area_2(i32* %15, i32 4, i32 0, i32 3)
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
ret i32 0
}