#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_trie(char *, char *, struct trienode **);
void build_index(char file[], char *f[], int len, struct trienode **root) {
  for (int i = 0; i < len; i++) {
    insert_trie(file, f[i], root);
  }
}


x86 assembly (clang, -O0):
<build_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1161 <build_index+0x51>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <insert_trie@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112e <build_index+0x1e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_index>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edx,%edx
jle    1148 <build_index+0x38>
mov    %rcx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %edx,%r13d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
call   1030 <insert_trie@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1130 <build_index+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.trienode = type { i32 }
define void @build_index(i8* %0, i8** %1, i32 %2, %struct.trienode** %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
%8 = alloca %struct.trienode**
%9 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store %struct.trienode** %3, %struct.trienode*** %8
store i32 0, i32* %9
br label %10
10: ; preds = %23, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %26
14: ; preds = %10
%15 = load i8*, i8** %5
%16 = load i8**, i8*** %6
%17 = load i32, i32* %9
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = load %struct.trienode**, %struct.trienode*** %8
%22 = call i32 @insert_trie(i8* %15, i8* %20, %struct.trienode** %21)
br label %23
23: ; preds = %14
%24 = load i32, i32* %9
%25 = add nsw i32 %24, 1
store i32 %25, i32* %9
br label %10
26: ; preds = %10
ret void
}

LLVM IR (-O2):
%struct.trienode = type { i32 }
define void @build_index(i8* %0, i8** nocapture %1, i32 %2, %struct.trienode** %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = zext i32 %2 to i64
br label %9
8: ; preds = %9, %4
ret void
9: ; preds = %6, %9
%10 = phi i64 [ 0, %6 ], [ %14, %9 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i32 @insert_trie(i8* %0, i8* %12, %struct.trienode** %3)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, %7
br i1 %15, label %8, label %9
}