#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);
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
char *strdup(char *);
char **get_entire_array(int *len) {
  char instring[1024];
  static char *array[32767];
  int i;
  for (i = 0; get_line(instring, stdin); i++) {
    if (i == 32767) {
      fprintf(stderr, "ERROR: max lines exceeded: %d\n", 32767);
      exit(1);
    } else
      array[i] = strdup(instring);
  }
  *len = i;
  return array;
}


x86 assembly (clang, -O0):
<get_entire_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x414(%rbp)
lea    -0x410(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     11e6 <get_entire_array+0xa6>
cmpl   $0x7fff,-0x414(%rbp)
jne    11ac <get_entire_array+0x6c>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
mov    $0x7fff,%edx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    -0x410(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,%rdx
movslq -0x414(%rbp),%rcx
lea    0x2e87(%rip),%rax
mov    %rdx,(%rax,%rcx,8)
jmp    11d2 <get_entire_array+0x92>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    1159 <get_entire_array+0x19>
mov    -0x414(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
lea    0x2e57(%rip),%rax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_entire_array>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%r14
mov    0x2e8e(%rip),%r15
mov    (%r15),%esi
mov    %rsp,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     11b1 <get_entire_array+0x71>
lea    0x2edf(%rip),%rbx
xor    %r13d,%r13d
mov    %rsp,%r12
nopw   0x0(%rax,%rax,1)
cmp    $0xffffffffffff8001,%r13
je     11cf <get_entire_array+0x8f>
mov    %r12,%rdi
call   1060 <strdup@plt>
mov    %rax,(%rbx)
mov    (%r15),%esi
mov    %r12,%rdi
call   1030 <get_line@plt>
add    $0xffffffffffffffff,%r13
add    $0x8,%rbx
test   %rax,%rax
jne    1180 <get_entire_array+0x40>
neg    %r13d
jmp    11b4 <get_entire_array+0x74>
xor    %r13d,%r13d
mov    %r13d,(%r14)
lea    0x2e92(%rip),%rax
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    0x2e02(%rip),%rax
mov    (%rax),%edi
lea    0xe21(%rip),%rsi
mov    $0x7fff,%edx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@get_entire_array.array = internal global [32767 x i8*] zeroinitializer
@stdin = global i32 0
@stderr = global i32 0
@.str = [31 x i8] c"ERROR: max lines exceeded: %d\0A\00"
define i8** @get_entire_array(i32* %0) {
%2 = alloca i32*
%3 = alloca [1024 x i8]
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %4
br label %5
5: ; preds = %24, %1
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i64 @get_line(i8* %6, i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %27
10: ; preds = %5
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 32767
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 32767)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %10
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%19 = call i8* @strdup(i8* %18)
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [32767 x i8*], [32767 x i8*]* @get_entire_array.array, i64 0, i64 %21
store i8* %19, i8** %22
br label %23
23: ; preds = %17
br label %24
24: ; preds = %23
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %5
27: ; preds = %5
%28 = load i32, i32* %4
%29 = load i32*, i32** %2
store i32 %28, i32* %29
ret i8** getelementptr inbounds ([32767 x i8*], [32767 x i8*]* @get_entire_array.array, i64 0, i64 0)
}

LLVM IR (-O2):
@get_entire_array.array = internal global [32767 x i8*] zeroinitializer
@stdin = global i32 0
@stderr = global i32 0
@.str = [31 x i8] c"ERROR: max lines exceeded: %d\0A\00"
define i8** @get_entire_array(i32* nocapture writeonly %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i64 @get_line(i8* %3, i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %23, label %7
7: ; preds = %1, %14
%8 = phi i64 [ %17, %14 ], [ 0, %1 ]
%9 = icmp eq i64 %8, 32767
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 32767)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %7
%15 = call i8* @strdup(i8* %3)
%16 = getelementptr inbounds [32767 x i8*], [32767 x i8*]* @get_entire_array.array, i64 0, i64 %8
store i8* %15, i8** %16
%17 = add nuw nsw i64 %8, 1
%18 = load i32, i32* @stdin
%19 = call i64 @get_line(i8* %3, i32 %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %7
21: ; preds = %14
%22 = trunc i64 %17 to i32
br label %23
23: ; preds = %21, %1
%24 = phi i32 [ 0, %1 ], [ %22, %21 ]
store i32 %24, i32* %0
ret i8** getelementptr inbounds ([32767 x i8*], [32767 x i8*]* @get_entire_array.array, i64 0, i64 0)
}