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

/* Variables and functions */
int /*<<< orphan*/ insert(struct TrieNode *, char *);
int /*<<< orphan*/ printf(char *, char);
char search(struct TrieNode *, char *);
char startsWith(struct TrieNode *, char *);
struct TrieNode *trieCreate();
int /*<<< orphan*/ trieFree(struct TrieNode *);
int main(int argc, char **argv) {
  char ret;
  struct TrieNode *node = trieCreate();
  insert(node, "somestring");
  insert(node, "toto");
  insert(node, "tata");
  insert(node, "tutu");
  insert(node, "titi");
  insert(node, "tati");
  insert(node, "tatitu");
  ret = startsWith(node, "ta");
  printf("ret:%d\n", ret);
  ret = search(node, "titi");
  printf("ret:%d\n", ret);
  ret = search(node, "ta");
  printf("ret:%d\n", ret);
  ret = search(node, "tarte");
  printf("ret:%d\n", ret);
  trieFree(node);
  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   1070 <trieCreate@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1080 <insert@plt>
mov    -0x20(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1080 <insert@plt>
mov    -0x20(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1080 <insert@plt>
mov    -0x20(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   1080 <insert@plt>
mov    -0x20(%rbp),%rdi
lea    0xe4e(%rip),%rsi
call   1080 <insert@plt>
mov    -0x20(%rbp),%rdi
lea    0xe43(%rip),%rsi
call   1080 <insert@plt>
mov    -0x20(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   1080 <insert@plt>
mov    -0x20(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1040 <startsWith@plt>
mov    %al,-0x11(%rbp)
lea    0xe20(%rip),%rdi
movsbl -0x11(%rbp),%esi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    0xdfb(%rip),%rsi
call   1060 <search@plt>
mov    %al,-0x11(%rbp)
lea    0xdfd(%rip),%rdi
movsbl -0x11(%rbp),%esi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    0xdd0(%rip),%rsi
call   1060 <search@plt>
mov    %al,-0x11(%rbp)
lea    0xdda(%rip),%rdi
movsbl -0x11(%rbp),%esi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
lea    0xdce(%rip),%rsi
call   1060 <search@plt>
mov    %al,-0x11(%rbp)
lea    0xdb7(%rip),%rdi
movsbl -0x11(%rbp),%esi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <trieFree@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <trieCreate@plt>
mov    %rax,%rbx
lea    0xe87(%rip),%rsi
mov    %rax,%rdi
call   1080 <insert@plt>
lea    0xe83(%rip),%rsi
mov    %rbx,%rdi
call   1080 <insert@plt>
lea    0xe79(%rip),%rsi
mov    %rbx,%rdi
call   1080 <insert@plt>
lea    0xe6f(%rip),%rsi
mov    %rbx,%rdi
call   1080 <insert@plt>
lea    0xe65(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <insert@plt>
lea    0xe58(%rip),%rsi
mov    %rbx,%rdi
call   1080 <insert@plt>
lea    0xe4e(%rip),%rsi
mov    %rbx,%rdi
call   1080 <insert@plt>
lea    0xe2d(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <startsWith@plt>
movsbl %al,%esi
lea    0xe31(%rip),%r14
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <search@plt>
movsbl %al,%esi
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <search@plt>
movsbl %al,%esi
mov    %r14,%rdi
call   1050 <printf@plt>
lea    0xdfe(%rip),%rsi
mov    %rbx,%rdi
call   1060 <search@plt>
movsbl %al,%esi
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <trieFree@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TrieNode = type { i32 }
@.str = [11 x i8] c"somestring\00"
@.str.1 = [5 x i8] c"toto\00"
@.str.2 = [5 x i8] c"tata\00"
@.str.3 = [5 x i8] c"tutu\00"
@.str.4 = [5 x i8] c"titi\00"
@.str.5 = [5 x i8] c"tati\00"
@.str.6 = [7 x i8] c"tatitu\00"
@.str.7 = [3 x i8] c"ta\00"
@.str.8 = [8 x i8] c"ret:%d\0A\00"
@.str.9 = [6 x i8] c"tarte\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca %struct.TrieNode*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call %struct.TrieNode* (...) @trieCreate()
store %struct.TrieNode* %8, %struct.TrieNode** %7
%9 = load %struct.TrieNode*, %struct.TrieNode** %7
%10 = call i32 @insert(%struct.TrieNode* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%11 = load %struct.TrieNode*, %struct.TrieNode** %7
%12 = call i32 @insert(%struct.TrieNode* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%13 = load %struct.TrieNode*, %struct.TrieNode** %7
%14 = call i32 @insert(%struct.TrieNode* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%15 = load %struct.TrieNode*, %struct.TrieNode** %7
%16 = call i32 @insert(%struct.TrieNode* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%17 = load %struct.TrieNode*, %struct.TrieNode** %7
%18 = call i32 @insert(%struct.TrieNode* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%19 = load %struct.TrieNode*, %struct.TrieNode** %7
%20 = call i32 @insert(%struct.TrieNode* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%21 = load %struct.TrieNode*, %struct.TrieNode** %7
%22 = call i32 @insert(%struct.TrieNode* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%23 = load %struct.TrieNode*, %struct.TrieNode** %7
%24 = call signext i8 @startsWith(%struct.TrieNode* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
store i8 %24, i8* %6
%25 = load i8, i8* %6
%26 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8 signext %25)
%27 = load %struct.TrieNode*, %struct.TrieNode** %7
%28 = call signext i8 @search(%struct.TrieNode* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
store i8 %28, i8* %6
%29 = load i8, i8* %6
%30 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8 signext %29)
%31 = load %struct.TrieNode*, %struct.TrieNode** %7
%32 = call signext i8 @search(%struct.TrieNode* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
store i8 %32, i8* %6
%33 = load i8, i8* %6
%34 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8 signext %33)
%35 = load %struct.TrieNode*, %struct.TrieNode** %7
%36 = call signext i8 @search(%struct.TrieNode* %35, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
store i8 %36, i8* %6
%37 = load i8, i8* %6
%38 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8 signext %37)
%39 = load %struct.TrieNode*, %struct.TrieNode** %7
%40 = call i32 @trieFree(%struct.TrieNode* %39)
ret i32 0
}

LLVM IR (-O2):
%struct.TrieNode = type { i32 }
@.str = [11 x i8] c"somestring\00"
@.str.1 = [5 x i8] c"toto\00"
@.str.2 = [5 x i8] c"tata\00"
@.str.3 = [5 x i8] c"tutu\00"
@.str.4 = [5 x i8] c"titi\00"
@.str.5 = [5 x i8] c"tati\00"
@.str.6 = [7 x i8] c"tatitu\00"
@.str.7 = [3 x i8] c"ta\00"
@.str.8 = [8 x i8] c"ret:%d\0A\00"
@.str.9 = [6 x i8] c"tarte\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call %struct.TrieNode* (...) @trieCreate()
%4 = tail call i32 @insert(%struct.TrieNode* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @insert(%struct.TrieNode* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @insert(%struct.TrieNode* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @insert(%struct.TrieNode* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @insert(%struct.TrieNode* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 @insert(%struct.TrieNode* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%10 = tail call i32 @insert(%struct.TrieNode* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call signext i8 @startsWith(%struct.TrieNode* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%12 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8 signext %11)
%13 = tail call signext i8 @search(%struct.TrieNode* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%14 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8 signext %13)
%15 = tail call signext i8 @search(%struct.TrieNode* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%16 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8 signext %15)
%17 = tail call signext i8 @search(%struct.TrieNode* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%18 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8 signext %17)
%19 = tail call i32 @trieFree(%struct.TrieNode* %3)
ret i32 0
}