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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ str_list_clear_fn(struct str_list *, int /*<<< orphan*/ *);
struct str_list *str_list_create();
int /*<<< orphan*/ str_list_destroy(struct str_list *);
int /*<<< orphan*/ str_list_insert(struct str_list *, char *);
int /*<<< orphan*/ *str_list_lookup(struct str_list *, char *);
scalar_t__ strcmp(int /*<<< orphan*/ *, char *);
void test_lookup() {
  struct str_list *l = str_list_create();
  str_list_insert(l, "something");
  str_list_insert(l, "find me");
  str_list_insert(l, "random");
  assert(strcmp(str_list_lookup(l, "find me"), "find me") == 0);
  assert(str_list_lookup(l, "don't exists") == NULL);
  str_list_clear_fn(l, NULL);
  str_list_destroy(l);
}


x86 assembly (clang, -O0):
<test_lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <str_list_create@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1040 <str_list_insert@plt>
mov    -0x8(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1040 <str_list_insert@plt>
mov    -0x8(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1040 <str_list_insert@plt>
mov    -0x8(%rbp),%rdi
lea    0xe4c(%rip),%rsi
call   1070 <str_list_lookup@plt>
mov    %rax,%rdi
lea    0xe3d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1070 <str_list_lookup@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <str_list_clear_fn@plt>
mov    -0x8(%rbp),%rdi
call   1090 <str_list_destroy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_lookup>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <str_list_create@plt>
mov    %rax,%rbx
lea    0xe7b(%rip),%rsi
mov    %rax,%rdi
call   1040 <str_list_insert@plt>
lea    0xe76(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <str_list_insert@plt>
lea    0xe6c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <str_list_insert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <str_list_lookup@plt>
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
lea    0xe40(%rip),%rsi
mov    %rbx,%rdi
call   1070 <str_list_lookup@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <str_list_clear_fn@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1090 <str_list_destroy@plt>

LLVM IR (-O0):
%struct.str_list = type { i32 }
@.str = [10 x i8] c"something\00"
@.str.1 = [8 x i8] c"find me\00"
@.str.2 = [7 x i8] c"random\00"
@.str.3 = [13 x i8] c"don't exists\00"
define void @test_lookup() {
%1 = alloca %struct.str_list*
%2 = call %struct.str_list* (...) @str_list_create()
store %struct.str_list* %2, %struct.str_list** %1
%3 = load %struct.str_list*, %struct.str_list** %1
%4 = call i32 @str_list_insert(%struct.str_list* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = load %struct.str_list*, %struct.str_list** %1
%6 = call i32 @str_list_insert(%struct.str_list* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = load %struct.str_list*, %struct.str_list** %1
%8 = call i32 @str_list_insert(%struct.str_list* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%9 = load %struct.str_list*, %struct.str_list** %1
%10 = call i32* @str_list_lookup(%struct.str_list* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = call i64 @strcmp(i32* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load %struct.str_list*, %struct.str_list** %1
%16 = call i32* @str_list_lookup(%struct.str_list* %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i32* %16, null
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load %struct.str_list*, %struct.str_list** %1
%21 = call i32 @str_list_clear_fn(%struct.str_list* %20, i32* null)
%22 = load %struct.str_list*, %struct.str_list** %1
%23 = call i32 @str_list_destroy(%struct.str_list* %22)
ret void
}

LLVM IR (-O2):
%struct.str_list = type { i32 }
@.str = [10 x i8] c"something\00"
@.str.1 = [8 x i8] c"find me\00"
@.str.2 = [7 x i8] c"random\00"
@.str.3 = [13 x i8] c"don't exists\00"
define void @test_lookup() {
%1 = tail call %struct.str_list* (...) @str_list_create()
%2 = tail call i32 @str_list_insert(%struct.str_list* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @str_list_insert(%struct.str_list* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @str_list_insert(%struct.str_list* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32* @str_list_lookup(%struct.str_list* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i64 @strcmp(i32* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32* @str_list_lookup(%struct.str_list* %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i32* %10, null
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = tail call i32 @str_list_clear_fn(%struct.str_list* %1, i32* null)
%15 = tail call i32 @str_list_destroy(%struct.str_list* %1)
ret void
}