#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 match_string(char const **, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ write_log_standard(char *, char *);
int cfgfile_strval(char *option, char *value, char *name, int *location,
                   const char *table[], int more) {
  int val;
  if (strcmp(option, name) != 0)
    return 0;
  val = match_string(table, value);
  if (val == -1) {
    if (!more)
      write_log_standard("Unknown value for option `%s'.\n", option);
    return 1;
  }
  *location = val;
  return 1;
}


x86 assembly (clang, -O0):
<cfgfile_strval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1173 <cfgfile_strval+0x43>
movl   $0x0,-0x4(%rbp)
jmp    11c3 <cfgfile_strval+0x93>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <match_string@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    11b3 <cfgfile_strval+0x83>
cmpl   $0x0,-0x34(%rbp)
jne    11a7 <cfgfile_strval+0x77>
mov    -0x10(%rbp),%rsi
lea    0xe5e(%rip),%rdi
call   1050 <write_log_standard@plt>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <cfgfile_strval+0x93>
mov    -0x38(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cfgfile_strval>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8,%r12
mov    %rcx,%r15
mov    %rsi,%r13
mov    %rdi,%rbx
mov    %rdx,%rsi
call   1040 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
jne    118c <cfgfile_strval+0x5c>
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <match_string@plt>
cmp    $0xffffffff,%eax
je     1173 <cfgfile_strval+0x43>
mov    %eax,(%r15)
mov    $0x1,%ebp
jmp    118c <cfgfile_strval+0x5c>
mov    $0x1,%ebp
test   %r14d,%r14d
jne    118c <cfgfile_strval+0x5c>
lea    0xe7c(%rip),%rdi
mov    %rbx,%rsi
call   1050 <write_log_standard@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Unknown value for option `%s'.\0A\00"
define i32 @cfgfile_strval(i8* %0, i8* %1, i8* %2, i32* %3, i8** %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i8**
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i32* %3, i32** %11
store i8** %4, i8*** %12
store i32 %5, i32* %13
%15 = load i8*, i8** %8
%16 = load i8*, i8** %10
%17 = call i64 @strcmp(i8* %15, i8* %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %6
store i32 0, i32* %7
br label %36
20: ; preds = %6
%21 = load i8**, i8*** %12
%22 = load i8*, i8** %9
%23 = call i32 @match_string(i8** %21, i8* %22)
store i32 %23, i32* %14
%24 = load i32, i32* %14
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %33
26: ; preds = %20
%27 = load i32, i32* %13
%28 = icmp ne i32 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = load i8*, i8** %8
%31 = call i32 @write_log_standard(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %30)
br label %32
32: ; preds = %29, %26
store i32 1, i32* %7
br label %36
33: ; preds = %20
%34 = load i32, i32* %14
%35 = load i32*, i32** %11
store i32 %34, i32* %35
store i32 1, i32* %7
br label %36
36: ; preds = %33, %32, %19
%37 = load i32, i32* %7
ret i32 %37
}

LLVM IR (-O2):
@.str = [32 x i8] c"Unknown value for option `%s'.\0A\00"
define i32 @cfgfile_strval(i8* %0, i8* %1, i8* %2, i32* nocapture writeonly %3, i8** %4, i32 %5) {
%7 = tail call i64 @strcmp(i8* %0, i8* %2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = tail call i32 @match_string(i8** %4, i8* %1)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = icmp eq i32 %5, 0
br i1 %13, label %14, label %17
14: ; preds = %12
%15 = tail call i32 @write_log_standard(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %17
16: ; preds = %9
store i32 %10, i32* %3
br label %17
17: ; preds = %12, %14, %6, %16
%18 = phi i32 [ 1, %16 ], [ 0, %6 ], [ 1, %14 ], [ 1, %12 ]
ret i32 %18
}