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


x86 assembly (clang, -O0):
<postOrder>:
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 <postOrder+0x5c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shl    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <postOrder@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shl    $0x1,%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <postOrder@plt>
add    $0x10,%rsp
pop    %rbp
ret

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