#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int maximalRectangle(char **, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int strlen(char *);
int main(int argc, char **argv) {
  if (argc < 2) {
    fprintf(stderr, "Usage: ./test row1 row2...\n");
    exit(-1);
  }
  int i, j;
  int row_size = argc - 1;
  int col_size = strlen(argv[1]);
  for (i = 0; i < row_size; i++) {
    printf("%s\n", argv[i + 1]);
  }
  printf("%d\n", maximalRectangle(argv + 1, argc - 1, strlen(argv[1])));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    118f <main+0x3f>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11e8 <main+0x98>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11af <main+0x5f>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    %eax,%edx
call   1030 <maximalRectangle@plt>
mov    %eax,%esi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%edi
jle    11d6 <main+0x76>
mov    %rsi,%r12
mov    %edi,%r15d
add    $0xffffffff,%r15d
lea    0x8(%rsi),%r14
mov    0x8(%rsi),%rdi
call   1050 <strlen@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    0x8(%r12,%rbx,8),%rdi
add    $0x1,%rbx
call   1030 <puts@plt>
cmp    %rbx,%r15
jne    1190 <main+0x30>
mov    (%r14),%rdi
call   1050 <strlen@plt>
mov    %r14,%rdi
mov    %r15d,%esi
mov    %eax,%edx
call   1040 <maximalRectangle@plt>
lea    0xe5d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
lea    0xe1a(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: ./test row1 row2...\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [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 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 -1)
unreachable
16: ; preds = %2
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
store i32 %18, i32* %8
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @strlen(i8* %21)
store i32 %22, i32* %9
store i32 0, i32* %6
br label %23
23: ; preds = %35, %16
%24 = load i32, i32* %6
%25 = load i32, i32* %8
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %38
27: ; preds = %23
%28 = load i8**, i8*** %5
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %28, i64 %31
%33 = load i8*, i8** %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %27
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %23
38: ; preds = %23
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i32, i32* %4
%42 = sub nsw i32 %41, 1
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32 @strlen(i8* %45)
%47 = call i32 @maximalRectangle(i8** %40, i32 %42, i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %47)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: ./test row1 row2...\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = add nsw i32 %0, -1
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @strlen(i8* %11)
%13 = zext i32 %9 to i64
br label %14
14: ; preds = %8, %14
%15 = phi i64 [ 0, %8 ], [ %16, %14 ]
%16 = add nuw nsw i64 %15, 1
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i32 @puts(i8* dereferenceable(1) %18)
%20 = icmp eq i64 %16, %13
br i1 %20, label %21, label %14
21: ; preds = %14
%22 = load i8*, i8** %10
%23 = tail call i32 @strlen(i8* %22)
%24 = tail call i32 @maximalRectangle(i8** %10, i32 %9, i32 %23)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %24)
ret i32 0
}