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

/* Variables and functions */
int findmaxrow(char *, int);
int /*<<< orphan*/ get_rows(int, int, char *, int, char **);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int maxarea(char *board[], int rows, int cols) {
  char row[rows];
  int height, width, area = 0;
  for (int i = 0; i < cols; i++) {
    for (int j = 0; j <= i; j++) {
      memset(row, 0, sizeof(row) * sizeof(int));
      get_rows(j, i, row, rows, board);
      height = findmaxrow(row, rows);
      width = (i - j) + 1;
      if (area < height * width) {
        area = height * width;
      }
    }
  }
  return area;
}


x86 assembly (clang, -O0):
<maxarea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x48(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1221 <maxarea+0xf1>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jg     120e <maxarea+0xde>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x40(%rbp),%rdx
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%r8
call   1050 <get_rows@plt>
mov    -0x40(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <findmaxrow@plt>
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%eax
sub    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x24(%rbp),%ecx
imul   -0x28(%rbp),%ecx
cmp    %ecx,%eax
jge    11fb <maxarea+0xcb>
mov    -0x24(%rbp),%eax
imul   -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    1200 <maxarea+0xd0>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    118d <maxarea+0x5d>
jmp    1213 <maxarea+0xe3>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    117a <maxarea+0x4a>
mov    -0x2c(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxarea>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %esi,%eax
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,%rsp
mov    %edx,-0x34(%rbp)
test   %edx,%edx
jle    120d <maxarea+0xdd>
mov    %rcx,-0x48(%rbp)
mov    %rdi,-0x58(%rbp)
mov    %rsi,-0x50(%rbp)
lea    0x0(,%rsi,4),%r12d
xor    %eax,%eax
mov    %rax,-0x30(%rbp)
mov    $0x1,%r13d
xor    %eax,%eax
mov    -0x48(%rbp),%r14
mov    -0x50(%rbp),%rbx
nopl   0x0(%rax)
mov    -0x30(%rbp),%rcx
add    $0x1,%ecx
mov    %ecx,-0x38(%rbp)
mov    %r13d,-0x3c(%rbp)
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,-0x40(%rbp)
mov    %r14,%rdi
xor    %esi,%esi
mov    %r12d,%edx
call   1030 <memset@plt>
mov    %r15d,%edi
mov    -0x30(%rbp),%rsi
mov    %r14,%rdx
mov    %ebx,%ecx
mov    -0x58(%rbp),%r8
call   1050 <get_rows@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <findmaxrow@plt>
imul   %r13d,%eax
mov    -0x40(%rbp),%ecx
cmp    %eax,%ecx
cmovge %ecx,%eax
add    $0x1,%r15d
add    $0xffffffff,%r13d
jne    11b0 <maxarea+0x80>
mov    -0x3c(%rbp),%r13d
add    $0x1,%r13d
mov    -0x38(%rbp),%edx
mov    %edx,%ecx
mov    %rcx,-0x30(%rbp)
cmp    -0x34(%rbp),%edx
jne    1190 <maxarea+0x60>
jmp    120f <maxarea+0xdf>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @maxarea(i8** %0, i32 %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%14 = load i32, i32* %5
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %7
%17 = alloca i8, i64 %15
store i64 %15, i64* %8
store i32 0, i32* %11
store i32 0, i32* %12
br label %18
18: ; preds = %56, %3
%19 = load i32, i32* %12
%20 = load i32, i32* %6
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %59
22: ; preds = %18
store i32 0, i32* %13
br label %23
23: ; preds = %52, %22
%24 = load i32, i32* %13
%25 = load i32, i32* %12
%26 = icmp sle i32 %24, %25
br i1 %26, label %27, label %55
27: ; preds = %23
%28 = mul i64 %15, 4
%29 = trunc i64 %28 to i32
%30 = call i32 @memset(i8* %17, i32 0, i32 %29)
%31 = load i32, i32* %13
%32 = load i32, i32* %12
%33 = load i32, i32* %5
%34 = load i8**, i8*** %4
%35 = call i32 @get_rows(i32 %31, i32 %32, i8* %17, i32 %33, i8** %34)
%36 = load i32, i32* %5
%37 = call i32 @findmaxrow(i8* %17, i32 %36)
store i32 %37, i32* %9
%38 = load i32, i32* %12
%39 = load i32, i32* %13
%40 = sub nsw i32 %38, %39
%41 = add nsw i32 %40, 1
store i32 %41, i32* %10
%42 = load i32, i32* %11
%43 = load i32, i32* %9
%44 = load i32, i32* %10
%45 = mul nsw i32 %43, %44
%46 = icmp slt i32 %42, %45
br i1 %46, label %47, label %51
47: ; preds = %27
%48 = load i32, i32* %9
%49 = load i32, i32* %10
%50 = mul nsw i32 %48, %49
store i32 %50, i32* %11
br label %51
51: ; preds = %47, %27
br label %52
52: ; preds = %51
%53 = load i32, i32* %13
%54 = add nsw i32 %53, 1
store i32 %54, i32* %13
br label %23
55: ; preds = %23
br label %56
56: ; preds = %55
%57 = load i32, i32* %12
%58 = add nsw i32 %57, 1
store i32 %58, i32* %12
br label %18
59: ; preds = %18
%60 = load i32, i32* %11
%61 = load i8*, i8** %7
ret i32 %60
}

LLVM IR (-O2):
define i32 @maxarea(i8** %0, i32 %1, i32 %2) {
%4 = zext i32 %1 to i64
%5 = alloca i8, i64 %4
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = shl i32 %1, 2
br label %9
9: ; preds = %7, %16
%10 = phi i32 [ 1, %7 ], [ %17, %16 ]
%11 = phi i32 [ 0, %7 ], [ %13, %16 ]
%12 = phi i32 [ 0, %7 ], [ %28, %16 ]
%13 = add nuw nsw i32 %11, 1
br label %19
14: ; preds = %16, %3
%15 = phi i32 [ 0, %3 ], [ %28, %16 ]
ret i32 %15
16: ; preds = %19
%17 = add nuw i32 %10, 1
%18 = icmp eq i32 %13, %2
br i1 %18, label %14, label %9
19: ; preds = %9, %19
%20 = phi i32 [ 0, %9 ], [ %29, %19 ]
%21 = phi i32 [ %12, %9 ], [ %28, %19 ]
%22 = call i32 @memset(i8* %5, i32 0, i32 %8)
%23 = call i32 @get_rows(i32 %20, i32 %11, i8* %5, i32 %1, i8** %0)
%24 = call i32 @findmaxrow(i8* %5, i32 %1)
%25 = sub nsw i32 %13, %20
%26 = mul nsw i32 %24, %25
%27 = icmp slt i32 %21, %26
%28 = select i1 %27, i32 %26, i32 %21
%29 = add nuw nsw i32 %20, 1
%30 = icmp eq i32 %29, %10
br i1 %30, label %16, label %19
}