#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
char *strdup(char *);
int _conf_parse_string(char *token, const char *name, char **value) {
  if (token) {
    if (*value) {
      fprintf(stderr, "Error: Duplicate %s value in configuration.\n", name);
      return 1;
    }
    while (token[0] == ' ' || token[0] == '\t')
      token++;
    *value = strdup(token);
    if (!*value) {
      fprintf(stderr, "Error: Out of memory.\n");
      return 1;
    }
  } else {
    fprintf(stderr, "Error: Empty %s value in configuration.\n", name);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_conf_parse_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1208 <_conf_parse_string+0xe8>
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     1174 <_conf_parse_string+0x54>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1236 <_conf_parse_string+0x116>
jmp    1179 <_conf_parse_string+0x59>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x21(%rbp)
je     119e <_conf_parse_string+0x7e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11ae <_conf_parse_string+0x8e>
jmp    11bf <_conf_parse_string+0x9f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1179 <_conf_parse_string+0x59>
mov    -0x10(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1203 <_conf_parse_string+0xe3>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1236 <_conf_parse_string+0x116>
jmp    122f <_conf_parse_string+0x10f>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe28(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1236 <_conf_parse_string+0x116>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_conf_parse_string>:
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%rdx
test   %rdi,%rdi
je     1173 <_conf_parse_string+0x53>
cmpq   $0x0,(%rbx)
je     1154 <_conf_parse_string+0x34>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
jmp    1183 <_conf_parse_string+0x63>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x20,%al
je     1150 <_conf_parse_string+0x30>
cmp    $0x9,%al
je     1150 <_conf_parse_string+0x30>
call   1040 <strdup@plt>
mov    %rax,%rcx
mov    %rax,(%rbx)
xor    %eax,%eax
test   %rcx,%rcx
je     1191 <_conf_parse_string+0x71>
pop    %rbx
ret
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rbx
ret
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    118a <_conf_parse_string+0x6a>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"Error: Duplicate %s value in configuration.\0A\00"
@.str.1 = [23 x i8] c"Error: Out of memory.\0A\00"
@.str.2 = [41 x i8] c"Error: Empty %s value in configuration.\0A\00"
define i32 @_conf_parse_string(i8* %0, i8* %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8**
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8** %2, i8*** %7
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %47
10: ; preds = %3
%11 = load i8**, i8*** %7
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %6
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 1, i32* %4
br label %52
18: ; preds = %10
br label %19
19: ; preds = %33, %18
%20 = load i8*, i8** %5
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 32
br i1 %24, label %31, label %25
25: ; preds = %19
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i64 0
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 9
br label %31
31: ; preds = %25, %19
%32 = phi i1 [ true, %19 ], [ %30, %25 ]
br i1 %32, label %33, label %36
33: ; preds = %31
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %5
br label %19
36: ; preds = %31
%37 = load i8*, i8** %5
%38 = call i8* @strdup(i8* %37)
%39 = load i8**, i8*** %7
store i8* %38, i8** %39
%40 = load i8**, i8*** %7
%41 = load i8*, i8** %40
%42 = icmp ne i8* %41, null
br i1 %42, label %46, label %43
43: ; preds = %36
%44 = load i32, i32* @stderr
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %4
br label %52
46: ; preds = %36
br label %51
47: ; preds = %3
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %6
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %49)
store i32 1, i32* %4
br label %52
51: ; preds = %46
store i32 0, i32* %4
br label %52
52: ; preds = %51, %47, %43, %14
%53 = load i32, i32* %4
ret i32 %53
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"Error: Duplicate %s value in configuration.\0A\00"
@.str.1 = [23 x i8] c"Error: Out of memory.\0A\00"
@.str.2 = [41 x i8] c"Error: Empty %s value in configuration.\0A\00"
define i32 @_conf_parse_string(i8* %0, i8* %1, i8** nocapture %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %22, label %5
5: ; preds = %3
%6 = load i8*, i8** %2
%7 = icmp eq i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %25
11: ; preds = %5, %14
%12 = phi i8* [ %15, %14 ], [ %0, %5 ]
%13 = load i8, i8* %12
switch i8 %13, label %16 [
i8 32, label %14
i8 9, label %14
]
14: ; preds = %11, %11
%15 = getelementptr inbounds i8, i8* %12, i64 1
br label %11
16: ; preds = %11
%17 = tail call i8* @strdup(i8* %12)
store i8* %17, i8** %2
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %25
22: ; preds = %3
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %25
25: ; preds = %16, %22, %19, %8
%26 = phi i32 [ 1, %8 ], [ 1, %19 ], [ 1, %22 ], [ 0, %16 ]
ret i32 %26
}