#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 _tree_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ tree_add_string(struct _tree_node *, char *);
int tree_match_string(struct _tree_node *, char *);
struct _tree_node *tree_new();
int /*<<< orphan*/ tree_print(struct _tree_node *, int /*<<< orphan*/);
int /*<<< orphan*/ tree_remove_string(struct _tree_node *, char *);
int main(int argc, const char *argv[]) {
  struct _tree_node *root = tree_new();
  tree_add_string(root, "/foo");
  tree_add_string(root, "/barbie");
  tree_add_string(root, "/food");
  tree_add_string(root, "/bbq");
  tree_add_string(root, "/barbeque");
  tree_add_string(root, "/barby");
  tree_add_string(root, "/baa");
  tree_add_string(root, "/{barbara,badass}/foo");
  tree_print(root, 0);
  printf("************************\n");
  tree_remove_string(root, "/baa");
  tree_remove_string(root, "/bbq");
  tree_print(root, 0);
  printf("search %i\n", tree_match_string(root, "bar"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <tree_new@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1080 <tree_add_string@plt>
mov    -0x18(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1080 <tree_add_string@plt>
mov    -0x18(%rbp),%rdi
lea    0xe5c(%rip),%rsi
call   1080 <tree_add_string@plt>
mov    -0x18(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1080 <tree_add_string@plt>
mov    -0x18(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1080 <tree_add_string@plt>
mov    -0x18(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1080 <tree_add_string@plt>
mov    -0x18(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   1080 <tree_add_string@plt>
mov    -0x18(%rbp),%rdi
lea    0xe2d(%rip),%rsi
call   1080 <tree_add_string@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1070 <tree_print@plt>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xdff(%rip),%rsi
call   1060 <tree_remove_string@plt>
mov    -0x18(%rbp),%rdi
lea    0xdd9(%rip),%rsi
call   1060 <tree_remove_string@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1070 <tree_print@plt>
mov    -0x18(%rbp),%rdi
lea    0xe14(%rip),%rsi
call   1050 <tree_match_string@plt>
mov    %eax,%esi
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <tree_new@plt>
mov    %rax,%rbx
lea    0xeb4(%rip),%rsi
mov    %rax,%rdi
call   1090 <tree_add_string@plt>
lea    0xe6b(%rip),%rsi
mov    %rbx,%rdi
call   1090 <tree_add_string@plt>
lea    0xe64(%rip),%rsi
mov    %rbx,%rdi
call   1090 <tree_add_string@plt>
lea    0xe5b(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <tree_add_string@plt>
lea    0xe4e(%rip),%rsi
mov    %rbx,%rdi
call   1090 <tree_add_string@plt>
lea    0xe49(%rip),%rsi
mov    %rbx,%rdi
call   1090 <tree_add_string@plt>
lea    0xe41(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <tree_add_string@plt>
lea    0xe34(%rip),%rsi
mov    %rbx,%rdi
call   1090 <tree_add_string@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <tree_print@plt>
lea    0xe40(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <tree_remove_string@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <tree_remove_string@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <tree_print@plt>
lea    0xe10(%rip),%rsi
mov    %rbx,%rdi
call   1060 <tree_match_string@plt>
lea    0xdf6(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct._tree_node = type { i32 }
@.str = [5 x i8] c"/foo\00"
@.str.1 = [8 x i8] c"/barbie\00"
@.str.2 = [6 x i8] c"/food\00"
@.str.3 = [5 x i8] c"/bbq\00"
@.str.4 = [10 x i8] c"/barbeque\00"
@.str.5 = [7 x i8] c"/barby\00"
@.str.6 = [5 x i8] c"/baa\00"
@.str.7 = [22 x i8] c"/{barbara,badass}/foo\00"
@.str.8 = [26 x i8] c"************************\0A\00"
@.str.9 = [11 x i8] c"search %i\0A\00"
@.str.10 = [4 x i8] c"bar\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct._tree_node*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call %struct._tree_node* (...) @tree_new()
store %struct._tree_node* %7, %struct._tree_node** %6
%8 = load %struct._tree_node*, %struct._tree_node** %6
%9 = call i32 @tree_add_string(%struct._tree_node* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = load %struct._tree_node*, %struct._tree_node** %6
%11 = call i32 @tree_add_string(%struct._tree_node* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = load %struct._tree_node*, %struct._tree_node** %6
%13 = call i32 @tree_add_string(%struct._tree_node* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%14 = load %struct._tree_node*, %struct._tree_node** %6
%15 = call i32 @tree_add_string(%struct._tree_node* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%16 = load %struct._tree_node*, %struct._tree_node** %6
%17 = call i32 @tree_add_string(%struct._tree_node* %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%18 = load %struct._tree_node*, %struct._tree_node** %6
%19 = call i32 @tree_add_string(%struct._tree_node* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%20 = load %struct._tree_node*, %struct._tree_node** %6
%21 = call i32 @tree_add_string(%struct._tree_node* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%22 = load %struct._tree_node*, %struct._tree_node** %6
%23 = call i32 @tree_add_string(%struct._tree_node* %22, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%24 = load %struct._tree_node*, %struct._tree_node** %6
%25 = call i32 @tree_print(%struct._tree_node* %24, i32 0)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%27 = load %struct._tree_node*, %struct._tree_node** %6
%28 = call i32 @tree_remove_string(%struct._tree_node* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%29 = load %struct._tree_node*, %struct._tree_node** %6
%30 = call i32 @tree_remove_string(%struct._tree_node* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%31 = load %struct._tree_node*, %struct._tree_node** %6
%32 = call i32 @tree_print(%struct._tree_node* %31, i32 0)
%33 = load %struct._tree_node*, %struct._tree_node** %6
%34 = call i32 @tree_match_string(%struct._tree_node* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i32 %34)
ret i32 0
}

LLVM IR (-O2):
%struct._tree_node = type { i32 }
@.str = [5 x i8] c"/foo\00"
@.str.1 = [8 x i8] c"/barbie\00"
@.str.2 = [6 x i8] c"/food\00"
@.str.3 = [5 x i8] c"/bbq\00"
@.str.4 = [10 x i8] c"/barbeque\00"
@.str.5 = [7 x i8] c"/barby\00"
@.str.6 = [5 x i8] c"/baa\00"
@.str.7 = [22 x i8] c"/{barbara,badass}/foo\00"
@.str.9 = [11 x i8] c"search %i\0A\00"
@.str.10 = [4 x i8] c"bar\00"
@str = [25 x i8] c"************************\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call %struct._tree_node* (...) @tree_new()
%4 = tail call i32 @tree_add_string(%struct._tree_node* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @tree_add_string(%struct._tree_node* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @tree_add_string(%struct._tree_node* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @tree_add_string(%struct._tree_node* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @tree_add_string(%struct._tree_node* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 @tree_add_string(%struct._tree_node* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%10 = tail call i32 @tree_add_string(%struct._tree_node* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call i32 @tree_add_string(%struct._tree_node* %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%12 = tail call i32 @tree_print(%struct._tree_node* %3, i32 0)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @tree_remove_string(%struct._tree_node* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%15 = tail call i32 @tree_remove_string(%struct._tree_node* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%16 = tail call i32 @tree_print(%struct._tree_node* %3, i32 0)
%17 = tail call i32 @tree_match_string(%struct._tree_node* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i32 %17)
ret i32 0
}