#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 search(int *, int, int);
void printPostOrder(int in[], int pre[], int n) {
  int root = search(in, pre[0], n);
  if (root != 0)
    printPostOrder(in, pre + 1, root);
  if (root != n - 1)
    printPostOrder(in + root + 1, pre + root + 1, n - root - 1);
  printf("%d ", pre[0]);
}


x86 assembly (clang, -O0):
<printPostOrder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x14(%rbp),%edx
call   1040 <search@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1176 <printPostOrder+0x46>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
mov    -0x18(%rbp),%edx
call   1050 <printPostOrder@plt>
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     11bb <printPostOrder+0x8b>
mov    -0x8(%rbp),%rdi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0x4,%rdi
mov    -0x10(%rbp),%rsi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
add    $0x4,%rsi
mov    -0x14(%rbp),%edx
sub    -0x18(%rbp),%edx
sub    $0x1,%edx
call   1050 <printPostOrder@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPostOrder>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r15
mov    (%rsi),%esi
call   1040 <search@plt>
mov    %eax,%ebp
test   %eax,%eax
je     115b <printPostOrder+0x2b>
lea    0x4(%rbx),%rsi
mov    %r15,%rdi
mov    %ebp,%edx
call   1050 <printPostOrder@plt>
lea    -0x1(%r14),%eax
cmp    %eax,%ebp
je     1182 <printPostOrder+0x52>
movslq %ebp,%rax
lea    (%r15,%rax,4),%rdi
add    $0x4,%rdi
lea    (%rbx,%rax,4),%rsi
add    $0x4,%rsi
not    %ebp
add    %r14d,%ebp
mov    %ebp,%edx
call   1050 <printPostOrder@plt>
mov    (%rbx),%esi
lea    0xe75(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

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

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