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

/* Variables and functions */
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int getc(int /*<<< orphan*/ *);
scalar_t__ malloc(int);
unsigned int *get_tree_array(FILE *input_file, unsigned int tree_size) {
  unsigned int i;
  int *tree_array;
  tree_array = (unsigned int *)malloc(sizeof(unsigned int) * (tree_size));
  fseek(input_file, 2, (0));
  for (i = (0); i < tree_size; i++) {
    tree_array[i] = getc(input_file);
  }
  return (tree_array);
}


x86 assembly (clang, -O0):
<get_tree_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <fseek@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1197 <get_tree_array+0x67>
mov    -0x8(%rbp),%rdi
call   1050 <getc@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1168 <get_tree_array+0x38>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_tree_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x0(,%r15,4),%edi
call   1030 <malloc@plt>
mov    %rax,%r12
mov    %r14,%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <fseek@plt>
test   %r15d,%r15d
je     1185 <get_tree_array+0x55>
mov    %r15d,%r15d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1050 <getc@plt>
mov    %eax,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <get_tree_array+0x40>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32* @get_tree_array(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = zext i32 %7 to i64
%9 = mul i64 4, %8
%10 = trunc i64 %9 to i32
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i32*
store i32* %12, i32** %6
%13 = load i32*, i32** %3
%14 = call i32 @fseek(i32* %13, i32 2, i32 0)
store i32 0, i32* %5
br label %15
15: ; preds = %26, %2
%16 = load i32, i32* %5
%17 = load i32, i32* %4
%18 = icmp ult i32 %16, %17
br i1 %18, label %19, label %29
19: ; preds = %15
%20 = load i32*, i32** %3
%21 = call i32 @getc(i32* %20)
%22 = load i32*, i32** %6
%23 = load i32, i32* %5
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
store i32 %21, i32* %25
br label %26
26: ; preds = %19
%27 = load i32, i32* %5
%28 = add i32 %27, 1
store i32 %28, i32* %5
br label %15
29: ; preds = %15
%30 = load i32*, i32** %6
ret i32* %30
}

LLVM IR (-O2):
define i32* @get_tree_array(i32* nocapture %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i32*
%6 = tail call i32 @fseek(i32* %0, i32 2, i32 0)
%7 = icmp eq i32 %1, 0
br i1 %7, label %16, label %8
8: ; preds = %2
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %14, %10 ]
%12 = tail call i32 @getc(i32* %0)
%13 = getelementptr inbounds i32, i32* %5, i64 %11
store i32 %12, i32* %13
%14 = add nuw nsw i64 %11, 1
%15 = icmp eq i64 %14, %9
br i1 %15, label %16, label %10
16: ; preds = %10, %2
ret i32* %5
}