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

/* Variables and functions */
int max_area(int *, int);
int /*<<< orphan*/ printf(char *, ...);
void main() {
  int A[] = {7, 10, 3, 6, 4, 5};
  int i, maxarea = 0;
  int size = sizeof(A) / 4;
  printf("\n size is %d ", size);
  maxarea = max_area(A, size);
  printf("\nMax Area of ");
  for (i = 0; i < size; i++) {
    printf(" %d ", A[i]);
  }
  printf(" is %d.\n", maxarea);
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x6,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1040 <max_area@plt>
mov    %eax,-0x28(%rbp)
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11bc <main+0x9c>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118c <main+0x6c>
mov    -0x28(%rbp),%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    0xee3(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xec7(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed4(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rdi
mov    $0x6,%esi
call   1040 <max_area@plt>
mov    %eax,%ebp
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
lea    0xeaa(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe66(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.A = [6 x i32] [i32 7, i32 10, i32 3, i32 6, i32 4, i32 5]
@.str = [14 x i8] c"\0A size is %d \00"
@.str.1 = [14 x i8] c"\0AMax Area of \00"
@.str.2 = [5 x i8] c" %d \00"
@.str.3 = [9 x i8] c" is %d.\0A\00"
define void @main() {
%1 = alloca [6 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [6 x i32]* %1 to i8*
store i32 0, i32* %3
store i32 6, i32* %4
%6 = load i32, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%9 = load i32, i32* %4
%10 = call i32 @max_area(i32* %8, i32 %9)
store i32 %10, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %12
12: ; preds = %22, %0
%13 = load i32, i32* %2
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %16
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %12
25: ; preds = %12
%26 = load i32, i32* %3
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %26)
ret void
}

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