#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_FAILURE;
int EXIT_SUCCESS;
void *calloc(int, int);
int /*<<< orphan*/ check_intInput(int *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ free_array(char **, int);
char *line_reading(int);
int /*<<< orphan*/ longest_area_in_array(char **, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
char *strerror(int /*<<< orphan*/);
int strlen(char *);
int main() {
  int n;
  printf("Enter n: ");
  check_intInput(&n);
  char **arrLine = calloc(n, sizeof(char *));
  if (!arrLine) {
    fprintf(stderr, "%s", strerror(errno));
    exit(EXIT_FAILURE);
  }
  int i;
  for (i = 0; i < n; i++) {
    char *line = line_reading(20);
    int lineLenght = strlen(line);
    arrLine[i] = calloc(lineLenght + 1, sizeof(char));
    if (!arrLine) {
      fprintf(stderr, "%s", strerror(errno));
      exit(EXIT_FAILURE);
    }
    strcpy(arrLine[i], line);
    free(line);
  }
  longest_area_in_array(arrLine, n);
  free_array(arrLine, n);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe2a(%rip),%rdi
call   1070 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1040 <check_intInput@plt>
mov    -0x8(%rbp),%edi
mov    $0x8,%esi
call   1090 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    123a <main+0x7a>
mov    0x2dd9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x28(%rbp),%edi
mov    %rax,%rdx
lea    0xde3(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12f7 <main+0x137>
mov    $0x14,%edi
call   10c0 <line_reading@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   1090 <calloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
cmpq   $0x0,-0x10(%rbp)
jne    12cb <main+0x10b>
mov    0x2d48(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2d34(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x2c(%rbp),%edi
mov    %rax,%rdx
lea    0xd52(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2d0c(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1241 <main+0x81>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   10b0 <longest_area_in_array@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1080 <free_array@plt>
mov    0x2cb2(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe30(%rip),%rdi
call   1070 <printf@plt>
lea    0xc(%rsp),%rdi
call   1040 <check_intInput@plt>
mov    0xc(%rsp),%r15d
mov    %r15d,%edi
mov    $0x8,%esi
call   1090 <calloc@plt>
test   %rax,%rax
je     1271 <main+0xb1>
mov    %rax,%r14
test   %r15d,%r15d
jle    1247 <main+0x87>
xor    %ebx,%ebx
mov    $0x14,%edi
call   10c0 <line_reading@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%edi
mov    $0x1,%esi
call   1090 <calloc@plt>
mov    %rax,(%r14,%rbx,8)
mov    %rax,%rdi
mov    %r15,%rsi
call   1050 <strcpy@plt>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%r15
cmp    %r15,%rbx
jl     1200 <main+0x40>
mov    %r14,%rdi
mov    %r15d,%esi
call   10b0 <longest_area_in_array@plt>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
call   1080 <free_array@plt>
mov    0x2d63(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2d68(%rip),%rax
mov    (%rax),%ebx
mov    0x2d57(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xd7b(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   10a0 <fprintf@plt>
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Enter n: \00"
@stderr = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @check_intInput(i32* %2)
%9 = load i32, i32* %2
%10 = call i8* @calloc(i32 %9, i32 8)
%11 = bitcast i8* %10 to i8**
store i8** %11, i8*** %3
%12 = load i8**, i8*** %3
%13 = icmp ne i8** %12, null
br i1 %13, label %21, label %14
14: ; preds = %0
%15 = load i32, i32* @stderr
%16 = load i32, i32* @errno
%17 = call i8* @strerror(i32 %16)
%18 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %0
store i32 0, i32* %4
br label %22
22: ; preds = %56, %21
%23 = load i32, i32* %4
%24 = load i32, i32* %2
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %59
26: ; preds = %22
%27 = call i8* @line_reading(i32 20)
store i8* %27, i8** %5
%28 = load i8*, i8** %5
%29 = call i32 @strlen(i8* %28)
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
%32 = call i8* @calloc(i32 %31, i32 1)
%33 = load i8**, i8*** %3
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %33, i64 %35
store i8* %32, i8** %36
%37 = load i8**, i8*** %3
%38 = icmp ne i8** %37, null
br i1 %38, label %46, label %39
39: ; preds = %26
%40 = load i32, i32* @stderr
%41 = load i32, i32* @errno
%42 = call i8* @strerror(i32 %41)
%43 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %42)
%44 = load i32, i32* @EXIT_FAILURE
%45 = call i32 @exit(i32 %44)
unreachable
46: ; preds = %26
%47 = load i8**, i8*** %3
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = load i8*, i8** %5
%53 = call i32 @strcpy(i8* %51, i8* %52)
%54 = load i8*, i8** %5
%55 = call i32 @free(i8* %54)
br label %56
56: ; preds = %46
%57 = load i32, i32* %4
%58 = add nsw i32 %57, 1
store i32 %58, i32* %4
br label %22
59: ; preds = %22
%60 = load i8**, i8*** %3
%61 = load i32, i32* %2
%62 = call i32 @longest_area_in_array(i8** %60, i32 %61)
%63 = load i8**, i8*** %3
%64 = load i32, i32* %2
%65 = call i32 @free_array(i8** %63, i32 %64)
%66 = load i32, i32* @EXIT_SUCCESS
ret i32 %66
}

LLVM IR (-O2):
@.str = [10 x i8] c"Enter n: \00"
@stderr = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @check_intInput(i32* %1)
%5 = load i32, i32* %1
%6 = call i8* @calloc(i32 %5, i32 8)
%7 = bitcast i8* %6 to i8**
%8 = icmp eq i8* %6, null
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = icmp sgt i32 %5, 0
br i1 %10, label %18, label %31
11: ; preds = %0
%12 = load i32, i32* @stderr
%13 = load i32, i32* @errno
%14 = call i8* @strerror(i32 %13)
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %9, %18
%19 = phi i64 [ %27, %18 ], [ 0, %9 ]
%20 = call i8* @line_reading(i32 20)
%21 = call i32 @strlen(i8* %20)
%22 = add nsw i32 %21, 1
%23 = call i8* @calloc(i32 %22, i32 1)
%24 = getelementptr inbounds i8*, i8** %7, i64 %19
store i8* %23, i8** %24
%25 = call i32 @strcpy(i8* %23, i8* %20)
%26 = call i32 @free(i8* %20)
%27 = add nuw nsw i64 %19, 1
%28 = load i32, i32* %1
%29 = sext i32 %28 to i64
%30 = icmp slt i64 %27, %29
br i1 %30, label %18, label %31
31: ; preds = %18, %9
%32 = phi i32 [ %5, %9 ], [ %28, %18 ]
%33 = call i32 @longest_area_in_array(i8** %7, i32 %32)
%34 = load i32, i32* %1
%35 = call i32 @free_array(i8** %7, i32 %34)
%36 = load i32, i32* @EXIT_SUCCESS
ret i32 %36
}