#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 */
int getClass(int *);
int *getNextEntry(int *);
int /*<<< orphan*/ getString(int *);
scalar_t__ stringCompare(int *, int /*<<< orphan*/);
int *searchSymbolTable(int *entry, int *string, int class) {
  while (entry != (int *)0) {
    if (stringCompare(string, getString(entry)))
      if (class == getClass(entry))
        return entry;
    entry = getNextEntry(entry);
  }
  return (int *)0;
}


x86 assembly (clang, -O0):
<searchSymbolTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11c4 <searchSymbolTable+0x84>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <getString@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1060 <stringCompare@plt>
cmp    $0x0,%rax
je     11b2 <searchSymbolTable+0x72>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <getClass@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
jne    11ad <searchSymbolTable+0x6d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11cc <searchSymbolTable+0x8c>
jmp    11b2 <searchSymbolTable+0x72>
mov    -0x10(%rbp),%rdi
call   1040 <getNextEntry@plt>
mov    %rax,-0x10(%rbp)
jmp    1153 <searchSymbolTable+0x13>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<searchSymbolTable>:
push   %rbp
push   %r14
push   %rbx
test   %rdi,%rdi
je     1196 <searchSymbolTable+0x56>
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %rdi,%rbx
jmp    1170 <searchSymbolTable+0x30>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1040 <getNextEntry@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1196 <searchSymbolTable+0x56>
mov    %rbx,%rdi
call   1030 <getString@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1060 <stringCompare@plt>
test   %rax,%rax
je     1160 <searchSymbolTable+0x20>
mov    %rbx,%rdi
call   1050 <getClass@plt>
cmp    %r14d,%eax
jne    1160 <searchSymbolTable+0x20>
jmp    1198 <searchSymbolTable+0x58>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32* @searchSymbolTable(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
br label %8
8: ; preds = %25, %3
%9 = load i32*, i32** %5
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %28
11: ; preds = %8
%12 = load i32*, i32** %6
%13 = load i32*, i32** %5
%14 = call i32 @getString(i32* %13)
%15 = call i64 @stringCompare(i32* %12, i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %11
%18 = load i32, i32* %7
%19 = load i32*, i32** %5
%20 = call i32 @getClass(i32* %19)
%21 = icmp eq i32 %18, %20
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = load i32*, i32** %5
store i32* %23, i32** %4
br label %29
24: ; preds = %17
br label %25
25: ; preds = %24, %11
%26 = load i32*, i32** %5
%27 = call i32* @getNextEntry(i32* %26)
store i32* %27, i32** %5
br label %8
28: ; preds = %8
store i32* null, i32** %4
br label %29
29: ; preds = %28, %22
%30 = load i32*, i32** %4
ret i32* %30
}

LLVM IR (-O2):
define i32* @searchSymbolTable(i32* %0, i32* %1, i32 %2) {
%4 = icmp eq i32* %0, null
br i1 %4, label %16, label %5
5: ; preds = %3, %13
%6 = phi i32* [ %14, %13 ], [ %0, %3 ]
%7 = tail call i32 @getString(i32* %6)
%8 = tail call i64 @stringCompare(i32* %1, i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = tail call i32 @getClass(i32* %6)
%12 = icmp eq i32 %11, %2
br i1 %12, label %16, label %13
13: ; preds = %10, %5
%14 = tail call i32* @getNextEntry(i32* %6)
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %5
16: ; preds = %10, %13, %3
%17 = phi i32* [ null, %3 ], [ null, %13 ], [ %6, %10 ]
ret i32* %17
}