#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 bst_insert(int, int *, int *, int *, int *);
int /*<<< orphan*/ recolor(int, int *, int *, int *, int *);
void rbt_insert(int item, int *items, int *_size, int *left, int *right,
                int *parent, int *color) {
  int size = *_size;
  parent[size] = bst_insert(item, items, _size, left, right);
  color[size] = 1;
  recolor(size, left, right, parent, color);
}


x86 assembly (clang, -O0):
<rbt_insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <bst_insert@plt>
mov    %eax,%edx
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x34(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    0x10(%rbp),%r8
call   1040 <recolor@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rbt_insert>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r12
mov    0x30(%rsp),%r13
movslq (%rdx),%rbx
call   1030 <bst_insert@plt>
mov    %eax,(%r14,%rbx,4)
movl   $0x1,0x0(%r13,%rbx,4)
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %r13,%r8
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <recolor@plt>

LLVM IR (-O0):
define void @rbt_insert(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6) {
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32
store i32 %0, i32* %8
store i32* %1, i32** %9
store i32* %2, i32** %10
store i32* %3, i32** %11
store i32* %4, i32** %12
store i32* %5, i32** %13
store i32* %6, i32** %14
%16 = load i32*, i32** %10
%17 = load i32, i32* %16
store i32 %17, i32* %15
%18 = load i32, i32* %8
%19 = load i32*, i32** %9
%20 = load i32*, i32** %10
%21 = load i32*, i32** %11
%22 = load i32*, i32** %12
%23 = call i32 @bst_insert(i32 %18, i32* %19, i32* %20, i32* %21, i32* %22)
%24 = load i32*, i32** %13
%25 = load i32, i32* %15
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
store i32 %23, i32* %27
%28 = load i32*, i32** %14
%29 = load i32, i32* %15
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
store i32 1, i32* %31
%32 = load i32, i32* %15
%33 = load i32*, i32** %11
%34 = load i32*, i32** %12
%35 = load i32*, i32** %13
%36 = load i32*, i32** %14
%37 = call i32 @recolor(i32 %32, i32* %33, i32* %34, i32* %35, i32* %36)
ret void
}

LLVM IR (-O2):
define void @rbt_insert(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6) {
%8 = load i32, i32* %2
%9 = tail call i32 @bst_insert(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds i32, i32* %5, i64 %10
store i32 %9, i32* %11
%12 = getelementptr inbounds i32, i32* %6, i64 %10
store i32 1, i32* %12
%13 = tail call i32 @recolor(i32 %8, i32* %3, i32* %4, i32* %5, i32* %6)
ret void
}