#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 section {
  int dummy;
};
struct configuration {
  int dummy;
};

/* Variables and functions */
struct section *get_configuration_section(char const *,
                                          struct configuration const *);
char *get_section_value(char const *, struct section const *);
char *get_configuration_value(const char *key, const char *section,
                              const struct configuration *cfg) {
  const struct section *section_ptr;
  if (key == NULL || section == NULL || cfg == NULL) {
    return NULL;
  }
  section_ptr = get_configuration_section(section, cfg);
  if (section_ptr != NULL) {
    return get_section_value(key, section_ptr);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<get_configuration_value>:
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     1155 <get_configuration_value+0x35>
cmpq   $0x0,-0x18(%rbp)
je     1155 <get_configuration_value+0x35>
cmpq   $0x0,-0x20(%rbp)
jne    1162 <get_configuration_value+0x42>
movq   $0x0,-0x8(%rbp)
jmp    119c <get_configuration_value+0x7c>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <get_configuration_section@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1194 <get_configuration_value+0x74>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <get_section_value@plt>
mov    %rax,-0x8(%rbp)
jmp    119c <get_configuration_value+0x7c>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_configuration_value>:
push   %rbx
test   %rdi,%rdi
je     114f <get_configuration_value+0x2f>
test   %rsi,%rsi
je     114f <get_configuration_value+0x2f>
test   %rdx,%rdx
je     114f <get_configuration_value+0x2f>
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <get_configuration_section@plt>
test   %rax,%rax
je     114f <get_configuration_value+0x2f>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1040 <get_section_value@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.configuration = type { i32 }
%struct.section = type { i32 }
define i8* @get_configuration_value(i8* %0, i8* %1, %struct.configuration* %2) {
%4 = icmp eq i8* %0, null
%5 = icmp eq i8* %1, null
%6 = or i1 %4, %5
%7 = icmp eq %struct.configuration* %2, null
%8 = or i1 %6, %7
br i1 %8, label %14, label %9
9: ; preds = %3
%10 = tail call %struct.section* @get_configuration_section(i8* %1, %struct.configuration* %2)
%11 = icmp eq %struct.section* %10, null
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = tail call i8* @get_section_value(i8* %0, %struct.section* %10)
br label %14
14: ; preds = %9, %3, %12
%15 = phi i8* [ %13, %12 ], [ null, %3 ], [ null, %9 ]
ret i8* %15
}