#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 format_field {
  int dummy;
};
struct event_format {
  int dummy;
};

/* Variables and functions */
struct format_field *pevent_find_common_field(struct event_format *,
                                              char const *);
struct format_field *pevent_find_field(struct event_format *, char const *);
struct format_field *pevent_find_any_field(struct event_format *event,
                                           const char *name) {
  struct format_field *format;
  format = pevent_find_common_field(event, name);
  if (format)
    return format;
  return pevent_find_field(event, name);
}


x86 assembly (clang, -O0):
<pevent_find_any_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <pevent_find_common_field@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1159 <pevent_find_any_field+0x39>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116a <pevent_find_any_field+0x4a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <pevent_find_field@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pevent_find_any_field>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <pevent_find_common_field@plt>
test   %rax,%rax
je     113c <pevent_find_any_field+0x1c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <pevent_find_field@plt>

LLVM IR (-O0):
%struct.format_field = type { i32 }
%struct.event_format = type { i32 }
define %struct.format_field* @pevent_find_any_field(%struct.event_format* %0, i8* %1) {
%3 = alloca %struct.format_field*
%4 = alloca %struct.event_format*
%5 = alloca i8*
%6 = alloca %struct.format_field*
store %struct.event_format* %0, %struct.event_format** %4
store i8* %1, i8** %5
%7 = load %struct.event_format*, %struct.event_format** %4
%8 = load i8*, i8** %5
%9 = call %struct.format_field* @pevent_find_common_field(%struct.event_format* %7, i8* %8)
store %struct.format_field* %9, %struct.format_field** %6
%10 = load %struct.format_field*, %struct.format_field** %6
%11 = icmp ne %struct.format_field* %10, null
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load %struct.format_field*, %struct.format_field** %6
store %struct.format_field* %13, %struct.format_field** %3
br label %18
14: ; preds = %2
%15 = load %struct.event_format*, %struct.event_format** %4
%16 = load i8*, i8** %5
%17 = call %struct.format_field* @pevent_find_field(%struct.event_format* %15, i8* %16)
store %struct.format_field* %17, %struct.format_field** %3
br label %18
18: ; preds = %14, %12
%19 = load %struct.format_field*, %struct.format_field** %3
ret %struct.format_field* %19
}

LLVM IR (-O2):
%struct.format_field = type { i32 }
%struct.event_format = type { i32 }
define %struct.format_field* @pevent_find_any_field(%struct.event_format* %0, i8* %1) {
%3 = tail call %struct.format_field* @pevent_find_common_field(%struct.event_format* %0, i8* %1)
%4 = icmp eq %struct.format_field* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call %struct.format_field* @pevent_find_field(%struct.event_format* %0, i8* %1)
br label %7
7: ; preds = %2, %5
%8 = phi %struct.format_field* [ %6, %5 ], [ %3, %2 ]
ret %struct.format_field* %8
}