#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 */
struct binary_tree_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ delete (struct binary_tree_node **, int);
int /*<<< orphan*/ insert(struct binary_tree_node **, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ traverse(struct binary_tree_node *);
int main(void) {
  struct binary_tree_node *root;
  int i = 0;
  int content[] = {11, 9, 13, 8, 10, 12, 14, 15, 7};
  root = NULL;
  while (i <= 8) {
    insert(&root, content[i]);
    i++;
  }
  traverse(root);
  printf("\n");
  delete (&root, 10);
  traverse(root);
  printf("\n");
  delete (&root, 14);
  traverse(root);
  printf("\n");
  delete (&root, 8);
  traverse(root);
  printf("\n");
  delete (&root, 13);
  traverse(root);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe8f(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
movq   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x14(%rbp)
jg     11ac <main+0x5c>
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    -0x10(%rbp),%rdi
call   1060 <insert@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1183 <main+0x33>
mov    -0x10(%rbp),%rdi
call   1040 <traverse@plt>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1070 <delete@plt>
mov    -0x10(%rbp),%rdi
call   1040 <traverse@plt>
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    $0xe,%esi
call   1070 <delete@plt>
mov    -0x10(%rbp),%rdi
call   1040 <traverse@plt>
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    $0x8,%esi
call   1070 <delete@plt>
mov    -0x10(%rbp),%rdi
call   1040 <traverse@plt>
lea    0xdff(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    $0xd,%esi
call   1070 <delete@plt>
mov    -0x10(%rbp),%rdi
call   1040 <traverse@plt>
lea    0xddc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xb,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0xe,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <insert@plt>
mov    0x8(%rsp),%rdi
call   1040 <traverse@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <delete@plt>
mov    0x8(%rsp),%rdi
call   1040 <traverse@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0xe,%esi
call   1060 <delete@plt>
mov    0x8(%rsp),%rdi
call   1040 <traverse@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1060 <delete@plt>
mov    0x8(%rsp),%rdi
call   1040 <traverse@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
call   1060 <delete@plt>
mov    0x8(%rsp),%rdi
call   1040 <traverse@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.binary_tree_node = type { i32 }
@__const.main.content = [9 x i32] [i32 11, i32 9, i32 13, i32 8, i32 10, i32 12, i32 14, i32 15, i32 7]
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.binary_tree_node*
%3 = alloca i32
%4 = alloca [9 x i32]
store i32 0, i32* %1
store i32 0, i32* %3
%5 = bitcast [9 x i32]* %4 to i8*
store %struct.binary_tree_node* null, %struct.binary_tree_node** %2
br label %6
6: ; preds = %9, %0
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 8
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = call i32 @insert(%struct.binary_tree_node** %2, i32 %13)
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %6
17: ; preds = %6
%18 = load %struct.binary_tree_node*, %struct.binary_tree_node** %2
%19 = call i32 @traverse(%struct.binary_tree_node* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @delete(%struct.binary_tree_node** %2, i32 10)
%22 = load %struct.binary_tree_node*, %struct.binary_tree_node** %2
%23 = call i32 @traverse(%struct.binary_tree_node* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @delete(%struct.binary_tree_node** %2, i32 14)
%26 = load %struct.binary_tree_node*, %struct.binary_tree_node** %2
%27 = call i32 @traverse(%struct.binary_tree_node* %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%29 = call i32 @delete(%struct.binary_tree_node** %2, i32 8)
%30 = load %struct.binary_tree_node*, %struct.binary_tree_node** %2
%31 = call i32 @traverse(%struct.binary_tree_node* %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%33 = call i32 @delete(%struct.binary_tree_node** %2, i32 13)
%34 = load %struct.binary_tree_node*, %struct.binary_tree_node** %2
%35 = call i32 @traverse(%struct.binary_tree_node* %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.binary_tree_node = type { i32 }
define i32 @main() {
%1 = alloca %struct.binary_tree_node*
%2 = bitcast %struct.binary_tree_node** %1 to i8*
store %struct.binary_tree_node* null, %struct.binary_tree_node** %1
%3 = call i32 @insert(%struct.binary_tree_node** %1, i32 11)
%4 = call i32 @insert(%struct.binary_tree_node** %1, i32 9)
%5 = call i32 @insert(%struct.binary_tree_node** %1, i32 13)
%6 = call i32 @insert(%struct.binary_tree_node** %1, i32 8)
%7 = call i32 @insert(%struct.binary_tree_node** %1, i32 10)
%8 = call i32 @insert(%struct.binary_tree_node** %1, i32 12)
%9 = call i32 @insert(%struct.binary_tree_node** %1, i32 14)
%10 = call i32 @insert(%struct.binary_tree_node** %1, i32 15)
%11 = call i32 @insert(%struct.binary_tree_node** %1, i32 7)
%12 = load %struct.binary_tree_node*, %struct.binary_tree_node** %1
%13 = call i32 @traverse(%struct.binary_tree_node* %12)
%14 = call i32 @putchar(i32 10)
%15 = call i32 @delete(%struct.binary_tree_node** %1, i32 10)
%16 = load %struct.binary_tree_node*, %struct.binary_tree_node** %1
%17 = call i32 @traverse(%struct.binary_tree_node* %16)
%18 = call i32 @putchar(i32 10)
%19 = call i32 @delete(%struct.binary_tree_node** %1, i32 14)
%20 = load %struct.binary_tree_node*, %struct.binary_tree_node** %1
%21 = call i32 @traverse(%struct.binary_tree_node* %20)
%22 = call i32 @putchar(i32 10)
%23 = call i32 @delete(%struct.binary_tree_node** %1, i32 8)
%24 = load %struct.binary_tree_node*, %struct.binary_tree_node** %1
%25 = call i32 @traverse(%struct.binary_tree_node* %24)
%26 = call i32 @putchar(i32 10)
%27 = call i32 @delete(%struct.binary_tree_node** %1, i32 13)
%28 = load %struct.binary_tree_node*, %struct.binary_tree_node** %1
%29 = call i32 @traverse(%struct.binary_tree_node* %28)
%30 = call i32 @putchar(i32 10)
ret i32 0
}