#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*/ printf(char *, int);
void PreOrderGoster(int node, int *BST, int elemanSayisi) {
  if (node < elemanSayisi) {
    if (BST[node] != -1)
      printf("%d  ", BST[node]);
    PreOrderGoster(2 * node + 1, BST, elemanSayisi);
    PreOrderGoster(2 * node + 2, BST, elemanSayisi);
  }
}


x86 assembly (clang, -O0):
<PreOrderGoster>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1191 <PreOrderGoster+0x71>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
je     1167 <PreOrderGoster+0x47>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
shl    $0x1,%edi
add    $0x1,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <PreOrderGoster@plt>
mov    -0x4(%rbp),%edi
shl    $0x1,%edi
add    $0x2,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <PreOrderGoster@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PreOrderGoster>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%edi
jge    116f <PreOrderGoster+0x4f>
mov    %edx,%ebp
mov    %rsi,%r14
mov    %edi,%ebx
lea    0xec7(%rip),%r15
jmp    1159 <PreOrderGoster+0x39>
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbx,1),%edi
add    $0x1,%edi
mov    %r14,%rsi
mov    %ebp,%edx
call   1030 <PreOrderGoster@plt>
add    %ebx,%ebx
add    $0x2,%ebx
cmp    %ebp,%ebx
jge    116f <PreOrderGoster+0x4f>
movslq %ebx,%rax
mov    (%r14,%rax,4),%esi
cmp    $0xffffffff,%esi
je     1140 <PreOrderGoster+0x20>
mov    %r15,%rdi
call   1040 <printf@plt>
jmp    1140 <PreOrderGoster+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d \00"
define void @PreOrderGoster(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %6
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %35
10: ; preds = %3
%11 = load i32*, i32** %5
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %24
17: ; preds = %10
%18 = load i32*, i32** %5
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %17, %10
%25 = load i32, i32* %4
%26 = mul nsw i32 2, %25
%27 = add nsw i32 %26, 1
%28 = load i32*, i32** %5
%29 = load i32, i32* %6
%30 = load i32, i32* %4
%31 = mul nsw i32 2, %30
%32 = add nsw i32 %31, 2
%33 = load i32*, i32** %5
%34 = load i32, i32* %6
br label %35
35: ; preds = %24, %3
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d \00"
define void @PreOrderGoster(i32 %0, i32* %1, i32 %2) {
%4 = icmp slt i32 %0, %2
br i1 %4, label %5, label %18
5: ; preds = %3, %13
%6 = phi i32 [ %16, %13 ], [ %0, %3 ]
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %1, i64 %7
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, -1
br i1 %10, label %13, label %11
11: ; preds = %5
%12 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %13
13: ; preds = %11, %5
%14 = shl nsw i32 %6, 1
%15 = or i32 %14, 1
tail call void @PreOrderGoster(i32 %15, i32* %1, i32 %2)
%16 = add nsw i32 %14, 2
%17 = icmp slt i32 %16, %2
br i1 %17, label %5, label %18
18: ; preds = %13, %3
ret void
}