#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 filepirate {
  int dummy;
};
struct candidate_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ candidate_list_dump(struct candidate_list *);
struct candidate_list *fp_candidate_list_create(int);
int /*<<< orphan*/ fp_candidate_list_destroy(struct candidate_list *);
int /*<<< orphan*/ fp_get_candidates(struct filepirate *, char *, scalar_t__,
                                     struct candidate_list *);
scalar_t__ strlen(char *);
void filepirate_search_once(struct filepirate *fp, char *term) {
  struct candidate_list *candidates;
  candidates = fp_candidate_list_create(10);
  fp_get_candidates(fp, term, strlen(term) + 1, candidates);
  candidate_list_dump(candidates);
  fp_candidate_list_destroy(candidates);
}


x86 assembly (clang, -O0):
<filepirate_search_once>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xa,%edi
call   1060 <fp_candidate_list_create@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
mov    -0x18(%rbp),%rcx
call   1030 <fp_get_candidates@plt>
mov    -0x18(%rbp),%rdi
call   1050 <candidate_list_dump@plt>
mov    -0x18(%rbp),%rdi
call   1070 <fp_candidate_list_destroy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filepirate_search_once>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    $0xa,%edi
call   1060 <fp_candidate_list_create@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rcx
call   1030 <fp_get_candidates@plt>
mov    %rbx,%rdi
call   1050 <candidate_list_dump@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <fp_candidate_list_destroy@plt>

LLVM IR (-O0):
%struct.filepirate = type { i32 }
%struct.candidate_list = type { i32 }
define void @filepirate_search_once(%struct.filepirate* %0, i8* %1) {
%3 = alloca %struct.filepirate*
%4 = alloca i8*
%5 = alloca %struct.candidate_list*
store %struct.filepirate* %0, %struct.filepirate** %3
store i8* %1, i8** %4
%6 = call %struct.candidate_list* @fp_candidate_list_create(i32 10)
store %struct.candidate_list* %6, %struct.candidate_list** %5
%7 = load %struct.filepirate*, %struct.filepirate** %3
%8 = load i8*, i8** %4
%9 = load i8*, i8** %4
%10 = call i64 @strlen(i8* %9)
%11 = add nsw i64 %10, 1
%12 = load %struct.candidate_list*, %struct.candidate_list** %5
%13 = call i32 @fp_get_candidates(%struct.filepirate* %7, i8* %8, i64 %11, %struct.candidate_list* %12)
%14 = load %struct.candidate_list*, %struct.candidate_list** %5
%15 = call i32 @candidate_list_dump(%struct.candidate_list* %14)
%16 = load %struct.candidate_list*, %struct.candidate_list** %5
%17 = call i32 @fp_candidate_list_destroy(%struct.candidate_list* %16)
ret void
}

LLVM IR (-O2):
%struct.filepirate = type { i32 }
%struct.candidate_list = type { i32 }
define void @filepirate_search_once(%struct.filepirate* %0, i8* %1) {
%3 = tail call %struct.candidate_list* @fp_candidate_list_create(i32 10)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add nsw i64 %4, 1
%6 = tail call i32 @fp_get_candidates(%struct.filepirate* %0, i8* %1, i64 %5, %struct.candidate_list* %3)
%7 = tail call i32 @candidate_list_dump(%struct.candidate_list* %3)
%8 = tail call i32 @fp_candidate_list_destroy(%struct.candidate_list* %3)
ret void
}