#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 KTreeNode {
  int dummy;
};
struct KTree {
  int dummy;
};

/* Variables and functions */
struct KTreeNode *add_keyword(struct KTree *, char *, int);
int /*<<< orphan*/ destruct_KTree(struct KTree *);
struct KTree *new_KTree();
int /*<<< orphan*/ trace_back_keyword(struct KTree *, int);
void test1() {
  struct KTree *ktree;
  ktree = new_KTree();
  struct KTreeNode *ptr_addedKeyword;
  ptr_addedKeyword = add_keyword(ktree, "01", 2);
  ptr_addedKeyword = add_keyword(ktree, "012", 3);
  ptr_addedKeyword = add_keyword(ktree, "012", 3);
  char *string_broken = "012\n3";
  ptr_addedKeyword = add_keyword(ktree, string_broken, 5);
  trace_back_keyword(ktree, 3);
  destruct_KTree(ktree);
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <new_KTree@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
mov    $0x2,%edx
call   1060 <add_keyword@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x3,%edx
call   1060 <add_keyword@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe73(%rip),%rsi
mov    $0x3,%edx
call   1060 <add_keyword@plt>
mov    %rax,-0x10(%rbp)
lea    0xe62(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x5,%edx
call   1060 <add_keyword@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1040 <trace_back_keyword@plt>
mov    -0x8(%rbp),%rdi
call   1050 <destruct_KTree@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <new_KTree@plt>
mov    %rax,%rbx
lea    0xeab(%rip),%rsi
mov    %rax,%rdi
mov    $0x2,%edx
call   1060 <add_keyword@plt>
lea    0xe9a(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1060 <add_keyword@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1060 <add_keyword@plt>
lea    0xe77(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1060 <add_keyword@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <trace_back_keyword@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <destruct_KTree@plt>

LLVM IR (-O0):
%struct.KTree = type { i32 }
%struct.KTreeNode = type { i32 }
@.str = [3 x i8] c"01\00"
@.str.1 = [4 x i8] c"012\00"
@.str.2 = [6 x i8] c"012\0A3\00"
define void @test1() {
%1 = alloca %struct.KTree*
%2 = alloca %struct.KTreeNode*
%3 = alloca i8*
%4 = call %struct.KTree* (...) @new_KTree()
store %struct.KTree* %4, %struct.KTree** %1
%5 = load %struct.KTree*, %struct.KTree** %1
%6 = call %struct.KTreeNode* @add_keyword(%struct.KTree* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
store %struct.KTreeNode* %6, %struct.KTreeNode** %2
%7 = load %struct.KTree*, %struct.KTree** %1
%8 = call %struct.KTreeNode* @add_keyword(%struct.KTree* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
store %struct.KTreeNode* %8, %struct.KTreeNode** %2
%9 = load %struct.KTree*, %struct.KTree** %1
%10 = call %struct.KTreeNode* @add_keyword(%struct.KTree* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
store %struct.KTreeNode* %10, %struct.KTreeNode** %2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %3
%11 = load %struct.KTree*, %struct.KTree** %1
%12 = load i8*, i8** %3
%13 = call %struct.KTreeNode* @add_keyword(%struct.KTree* %11, i8* %12, i32 5)
store %struct.KTreeNode* %13, %struct.KTreeNode** %2
%14 = load %struct.KTree*, %struct.KTree** %1
%15 = call i32 @trace_back_keyword(%struct.KTree* %14, i32 3)
%16 = load %struct.KTree*, %struct.KTree** %1
%17 = call i32 @destruct_KTree(%struct.KTree* %16)
ret void
}

LLVM IR (-O2):
%struct.KTree = type { i32 }
%struct.KTreeNode = type { i32 }
@.str = [3 x i8] c"01\00"
@.str.1 = [4 x i8] c"012\00"
@.str.2 = [6 x i8] c"012\0A3\00"
define void @test1() {
%1 = tail call %struct.KTree* (...) @new_KTree()
%2 = tail call %struct.KTreeNode* @add_keyword(%struct.KTree* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%3 = tail call %struct.KTreeNode* @add_keyword(%struct.KTree* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%4 = tail call %struct.KTreeNode* @add_keyword(%struct.KTree* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%5 = tail call %struct.KTreeNode* @add_keyword(%struct.KTree* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%6 = tail call i32 @trace_back_keyword(%struct.KTree* %1, i32 3)
%7 = tail call i32 @destruct_KTree(%struct.KTree* %1)
ret void
}