#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 inOrder(int *a, int i, int n) {
  if (i < n) {
    inOrder(a, 2 * i, n);
    printf("%d, ", a[i]);
    inOrder(a, 2 * i + 1, n);
  }
}


x86 assembly (clang, -O0):
<inOrder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    117c <inOrder+0x5c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shl    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <inOrder@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shl    $0x1,%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <inOrder@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inOrder>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1167 <inOrder+0x47>
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xec6(%rip),%r14
nopw   0x0(%rax,%rax,1)
lea    0x0(%rbp,%rbp,1),%esi
mov    %rbx,%rdi
mov    %r15d,%edx
call   1040 <inOrder@plt>
movslq %ebp,%rbp
mov    (%rbx,%rbp,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    %ebp,%ebp
add    $0x1,%ebp
cmp    %r15d,%ebp
jl     1140 <inOrder+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 @inOrder(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* %5
%8 = load i32, i32* %6
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %26
10: ; preds = %3
%11 = load i32*, i32** %4
%12 = load i32, i32* %5
%13 = mul nsw i32 2, %12
%14 = load i32, i32* %6
%15 = load i32*, i32** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32*, i32** %4
%22 = load i32, i32* %5
%23 = mul nsw i32 2, %22
%24 = add nsw i32 %23, 1
%25 = load i32, i32* %6
br label %26
26: ; preds = %10, %3
ret void
}

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