#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 */

/* Variables and functions */
char *calloc(int, int);
char *charalloc(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ get_token_llvm(char *, char *);
scalar_t__ strcmp(char *, char *);
int search_module_llvm(char *name, char *args) {
  char *line;
  char *token;
  token = calloc(1024, 1);
  line = charalloc(args);
  while (strcmp(line, "")) {
    get_token_llvm(line, token);
    if (!strcmp(token, name)) {
      free(line);
      return 0;
    }
  }
  free(token);
  free(line);
  return -1;
}


x86 assembly (clang, -O0):
<search_module_llvm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0x400,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <charalloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     11d8 <search_module_llvm+0x88>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <get_token_llvm@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11d3 <search_module_llvm+0x83>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f1 <search_module_llvm+0xa1>
jmp    1180 <search_module_llvm+0x30>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<search_module_llvm>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    $0x400,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1070 <charalloc@plt>
mov    %rax,%r15
lea    0xe7e(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11bf <search_module_llvm+0x6f>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <get_token_llvm@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1190 <search_module_llvm+0x40>
xor    %ebx,%ebx
jmp    11cc <search_module_llvm+0x7c>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0xffffffff,%ebx
mov    %r15,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @search_module_llvm(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = call i8* @calloc(i32 1024, i32 1)
store i8* %8, i8** %7
%9 = load i8*, i8** %5
%10 = call i8* @charalloc(i8* %9)
store i8* %10, i8** %6
br label %11
11: ; preds = %26, %2
%12 = load i8*, i8** %6
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %11
%16 = load i8*, i8** %6
%17 = load i8*, i8** %7
%18 = call i32 @get_token_llvm(i8* %16, i8* %17)
%19 = load i8*, i8** %7
%20 = load i8*, i8** %4
%21 = call i64 @strcmp(i8* %19, i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %15
%24 = load i8*, i8** %6
%25 = call i32 @free(i8* %24)
store i32 0, i32* %3
br label %32
26: ; preds = %15
br label %11
27: ; preds = %11
%28 = load i8*, i8** %7
%29 = call i32 @free(i8* %28)
%30 = load i8*, i8** %6
%31 = call i32 @free(i8* %30)
store i32 -1, i32* %3
br label %32
32: ; preds = %27, %23
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @search_module_llvm(i8* %0, i8* %1) {
%3 = tail call dereferenceable_or_null(1024) i8* @calloc(i32 1024, i32 1)
%4 = tail call i8* @charalloc(i8* %1)
br label %5
5: ; preds = %8, %2
%6 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = tail call i32 @get_token_llvm(i8* %4, i8* %3)
%10 = tail call i64 @strcmp(i8* %3, i8* %0)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %5
12: ; preds = %5
%13 = tail call i32 @free(i8* %3)
br label %14
14: ; preds = %8, %12
%15 = phi i32 [ -1, %12 ], [ 0, %8 ]
%16 = tail call i32 @free(i8* %4)
ret i32 %15
}