#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 */
unsigned int readNextName(char *, char **, char **, unsigned int *);
int /*<<< orphan*/ readNextString(char *, char **, char **, unsigned int *);
int /*<<< orphan*/ readNextValue(char *, char **, char **, unsigned char *);
void getSymbolSetting(unsigned int settingHash, char *rule,
                      unsigned int *symbolHash) {
  char *first;
  char *last;
  unsigned int hash;
  unsigned char type;
  unsigned int result = readNextName(rule, &first, &last, &hash);
  while (result == 0) {
    if (hash == settingHash) {
      readNextString(last, &first, &last, symbolHash);
      break;
    } else {
      readNextValue(last, &first, &last, &type);
      result = readNextName(last, &first, &last, &hash);
    }
  }
}


x86 assembly (clang, -O0):
<getSymbolSetting>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
call   1050 <readNextName@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    11bd <getSymbolSetting+0x8d>
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    118b <getSymbolSetting+0x5b>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rcx
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <readNextString@plt>
jmp    11bd <getSymbolSetting+0x8d>
mov    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2d(%rbp),%rcx
call   1030 <readNextValue@plt>
mov    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
call   1050 <readNextName@plt>
mov    %eax,-0x34(%rbp)
jmp    115b <getSymbolSetting+0x2b>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSymbolSetting>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%rax
mov    %edi,%r15d
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    %rax,%rdi
call   1050 <readNextName@plt>
test   %eax,%eax
jne    11c5 <getSymbolSetting+0x95>
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%rbp
lea    0x3(%rsp),%r12
lea    0x4(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
mov    0x8(%rsp),%rdi
cmp    %r15d,0x4(%rsp)
je     11b3 <getSymbolSetting+0x83>
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r12,%rcx
call   1030 <readNextValue@plt>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
call   1050 <readNextName@plt>
test   %eax,%eax
je     1180 <getSymbolSetting+0x50>
jmp    11c5 <getSymbolSetting+0x95>
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r14,%rcx
call   1040 <readNextString@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @getSymbolSetting(i32 %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8
%11 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%12 = load i8*, i8** %5
%13 = call i32 @readNextName(i8* %12, i8** %7, i8** %8, i32* %9)
store i32 %13, i32* %11
br label %14
14: ; preds = %30, %3
%15 = load i32, i32* %11
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %31
17: ; preds = %14
%18 = load i32, i32* %9
%19 = load i32, i32* %4
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i8*, i8** %8
%23 = load i32*, i32** %6
%24 = call i32 @readNextString(i8* %22, i8** %7, i8** %8, i32* %23)
br label %31
25: ; preds = %17
%26 = load i8*, i8** %8
%27 = call i32 @readNextValue(i8* %26, i8** %7, i8** %8, i8* %10)
%28 = load i8*, i8** %8
%29 = call i32 @readNextName(i8* %28, i8** %7, i8** %8, i32* %9)
store i32 %29, i32* %11
br label %30
30: ; preds = %25
br label %14
31: ; preds = %21, %14
ret void
}

LLVM IR (-O2):
define void @getSymbolSetting(i32 %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8
%8 = bitcast i8** %4 to i8*
%9 = bitcast i8** %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = call i32 @readNextName(i8* %1, i8** %4, i8** %5, i32* %6)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %24
13: ; preds = %3, %19
%14 = load i32, i32* %6
%15 = icmp eq i32 %14, %0
%16 = load i8*, i8** %5
br i1 %15, label %17, label %19
17: ; preds = %13
%18 = call i32 @readNextString(i8* %16, i8** %4, i8** %5, i32* %2)
br label %24
19: ; preds = %13
%20 = call i32 @readNextValue(i8* %16, i8** %4, i8** %5, i8* %7)
%21 = load i8*, i8** %5
%22 = call i32 @readNextName(i8* %21, i8** %4, i8** %5, i32* %6)
%23 = icmp eq i32 %22, 0
br i1 %23, label %13, label %24
24: ; preds = %19, %3, %17
ret void
}