#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 */
struct dspd_dict {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dspd_dict_find_value(struct dspd_dict const *, char const *,
                                        char **);
scalar_t__ strcmp(char const *, char *);
bool dspd_dict_test_value(const struct dspd_dict *sect, const char *key,
                          const char *value) {
  char *val;
  bool ret;
  if (!dspd_dict_find_value(sect, key, &val))
    return 0;
  if (val == NULL && value == NULL) {
    ret = 1;
  } else if (value == NULL || val == NULL) {
    ret = 0;
  } else {
    ret = (strcmp(value, val) == 0);
  }
  return ret;
}


x86 assembly (clang, -O0):
<dspd_dict_test_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1030 <dspd_dict_find_value@plt>
cmp    $0x0,%eax
jne    115a <dspd_dict_test_value+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <dspd_dict_test_value+0xa5>
cmpq   $0x0,-0x28(%rbp)
jne    117c <dspd_dict_test_value+0x5c>
cmpq   $0x0,-0x20(%rbp)
jne    117c <dspd_dict_test_value+0x5c>
movl   $0x1,-0x2c(%rbp)
jmp    11bf <dspd_dict_test_value+0x9f>
cmpq   $0x0,-0x20(%rbp)
je     1192 <dspd_dict_test_value+0x72>
cmpq   $0x0,-0x28(%rbp)
jne    119e <dspd_dict_test_value+0x7e>
movl   $0x0,-0x2c(%rbp)
jmp    11ba <dspd_dict_test_value+0x9a>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x2c(%rbp)
jmp    11bf <dspd_dict_test_value+0x9f>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dspd_dict_test_value>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
lea    0x8(%rsp),%rdx
call   1030 <dspd_dict_find_value@plt>
test   %eax,%eax
je     116c <dspd_dict_test_value+0x4c>
mov    0x8(%rsp),%rsi
mov    $0x1,%eax
mov    %rbx,%rcx
or     %rsi,%rcx
je     116e <dspd_dict_test_value+0x4e>
test   %rbx,%rbx
je     116c <dspd_dict_test_value+0x4c>
mov    $0x0,%eax
test   %rsi,%rsi
je     116e <dspd_dict_test_value+0x4e>
mov    %rbx,%rdi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
jmp    116e <dspd_dict_test_value+0x4e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.dspd_dict = type { i32 }
define i32 @dspd_dict_test_value(%struct.dspd_dict* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.dspd_dict*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store %struct.dspd_dict* %0, %struct.dspd_dict** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%10 = load %struct.dspd_dict*, %struct.dspd_dict** %5
%11 = load i8*, i8** %6
%12 = call i32 @dspd_dict_find_value(%struct.dspd_dict* %10, i8* %11, i8** %8)
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %3
store i32 0, i32* %4
br label %38
15: ; preds = %3
%16 = load i8*, i8** %8
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i8*, i8** %7
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 1, i32* %9
br label %36
22: ; preds = %18, %15
%23 = load i8*, i8** %7
%24 = icmp eq i8* %23, null
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i8*, i8** %8
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %29
28: ; preds = %25, %22
store i32 0, i32* %9
br label %35
29: ; preds = %25
%30 = load i8*, i8** %7
%31 = load i8*, i8** %8
%32 = call i64 @strcmp(i8* %30, i8* %31)
%33 = icmp eq i64 %32, 0
%34 = zext i1 %33 to i32
store i32 %34, i32* %9
br label %35
35: ; preds = %29, %28
br label %36
36: ; preds = %35, %21
%37 = load i32, i32* %9
store i32 %37, i32* %4
br label %38
38: ; preds = %36, %14
%39 = load i32, i32* %4
ret i32 %39
}

LLVM IR (-O2):
%struct.dspd_dict = type { i32 }
define i32 @dspd_dict_test_value(%struct.dspd_dict* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = call i32 @dspd_dict_find_value(%struct.dspd_dict* %0, i8* %1, i8** %4)
%7 = icmp eq i32 %6, 0
br i1 %7, label %19, label %8
8: ; preds = %3
%9 = load i8*, i8** %4
%10 = icmp eq i8* %9, null
%11 = icmp eq i8* %2, null
%12 = and i1 %11, %10
br i1 %12, label %19, label %13
13: ; preds = %8
%14 = select i1 %11, i1 true, i1 %10
br i1 %14, label %19, label %15
15: ; preds = %13
%16 = call i64 @strcmp(i8* %2, i8* %9)
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %15, %8, %13, %3
%20 = phi i32 [ 0, %3 ], [ %18, %15 ], [ 1, %8 ], [ 0, %13 ]
ret i32 %20
}