#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_of_ini {
  int dummy;
};
struct parsed_config {
  int dummy;
};
struct fields_of_ini {
  int dummy;
};

/* Variables and functions */
struct fields_of_ini *getFieldFromSection(char const *,
                                          struct section_of_ini *);
struct section_of_ini *getSection(char const *, struct parsed_config const *);
struct fields_of_ini *getField(const char *section_name, const char *field_name,
                               const struct parsed_config *c) {
  struct section_of_ini *sect = getSection(section_name, c);
  if (sect == NULL) {
    return NULL;
  }
  return getFieldFromSection(field_name, sect);
}


x86 assembly (clang, -O0):
<getField>:
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    -0x20(%rbp),%rsi
call   1030 <getSection@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    115d <getField+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    116e <getField+0x4e>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <getFieldFromSection@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getField>:
push   %rbx
mov    %rsi,%rbx
mov    %rdx,%rsi
call   1030 <getSection@plt>
test   %rax,%rax
je     113d <getField+0x1d>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1040 <getFieldFromSection@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.fields_of_ini = type { i32 }
%struct.parsed_config = type { i32 }
%struct.section_of_ini = type { i32 }
define %struct.fields_of_ini* @getField(i8* %0, i8* %1, %struct.parsed_config* %2) {
%4 = alloca %struct.fields_of_ini*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.parsed_config*
%8 = alloca %struct.section_of_ini*
store i8* %0, i8** %5
store i8* %1, i8** %6
store %struct.parsed_config* %2, %struct.parsed_config** %7
%9 = load i8*, i8** %5
%10 = load %struct.parsed_config*, %struct.parsed_config** %7
%11 = call %struct.section_of_ini* @getSection(i8* %9, %struct.parsed_config* %10)
store %struct.section_of_ini* %11, %struct.section_of_ini** %8
%12 = load %struct.section_of_ini*, %struct.section_of_ini** %8
%13 = icmp eq %struct.section_of_ini* %12, null
br i1 %13, label %14, label %15
14: ; preds = %3
store %struct.fields_of_ini* null, %struct.fields_of_ini** %4
br label %19
15: ; preds = %3
%16 = load i8*, i8** %6
%17 = load %struct.section_of_ini*, %struct.section_of_ini** %8
%18 = call %struct.fields_of_ini* @getFieldFromSection(i8* %16, %struct.section_of_ini* %17)
store %struct.fields_of_ini* %18, %struct.fields_of_ini** %4
br label %19
19: ; preds = %15, %14
%20 = load %struct.fields_of_ini*, %struct.fields_of_ini** %4
ret %struct.fields_of_ini* %20
}

LLVM IR (-O2):
%struct.fields_of_ini = type { i32 }
%struct.parsed_config = type { i32 }
%struct.section_of_ini = type { i32 }
define %struct.fields_of_ini* @getField(i8* %0, i8* %1, %struct.parsed_config* %2) {
%4 = tail call %struct.section_of_ini* @getSection(i8* %0, %struct.parsed_config* %2)
%5 = icmp eq %struct.section_of_ini* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call %struct.fields_of_ini* @getFieldFromSection(i8* %1, %struct.section_of_ini* %4)
br label %8
8: ; preds = %3, %6
%9 = phi %struct.fields_of_ini* [ %7, %6 ], [ null, %3 ]
ret %struct.fields_of_ini* %9
}