#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);
int /*<<< orphan*/ scanf(char *, int *);
void PreOrderAl(int node, int *BST, int elemanSayisi) {
  if (node < elemanSayisi) {
    printf("%d. elemani girin> ", node);
    scanf("%d", &BST[node]);
    PreOrderAl(2 * node + 1, BST, elemanSayisi);
    PreOrderAl(2 * node + 2, BST, elemanSayisi);
  }
}


x86 assembly (clang, -O0):
<PreOrderAl>:
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    11a2 <PreOrderAl+0x72>
mov    -0x4(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea1(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%edi
shl    $0x1,%edi
add    $0x1,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <PreOrderAl@plt>
mov    -0x4(%rbp),%edi
shl    $0x1,%edi
add    $0x2,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <PreOrderAl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PreOrderAl>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    %edx,%edi
jge    1190 <PreOrderAl+0x60>
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xeb6(%rip),%r15
lea    0xec3(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
movslq %ebp,%rbp
lea    (%r14,%rbp,4),%rsi
mov    %r12,%rdi
call   1040 <scanf@plt>
lea    0x1(%rbp,%rbp,1),%edi
mov    %r14,%rsi
mov    %ebx,%edx
call   1050 <PreOrderAl@plt>
add    %ebp,%ebp
add    $0x2,%ebp
cmp    %ebx,%ebp
jl     1160 <PreOrderAl+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"%d. elemani girin> \00"
@.str.1 = [3 x i8] c"%d\00"
define void @PreOrderAl(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 %28
10: ; preds = %3
%11 = load i32, i32* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32*, i32** %5
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %4
%19 = mul nsw i32 2, %18
%20 = add nsw i32 %19, 1
%21 = load i32*, i32** %5
%22 = load i32, i32* %6
%23 = load i32, i32* %4
%24 = mul nsw i32 2, %23
%25 = add nsw i32 %24, 2
%26 = load i32*, i32** %5
%27 = load i32, i32* %6
br label %28
28: ; preds = %10, %3
ret void
}

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