#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 ic_token_list {
  int dummy;
};
struct ic_decl {
  int dummy;
};

/* Variables and functions */
struct ic_decl *ic_parse_decl_type_union_body(struct ic_token_list *,
                                              struct ic_decl *);
struct ic_decl *ic_parse_decl_type_union_header(struct ic_token_list *);
int /*<<< orphan*/ puts(char *);
struct ic_decl *ic_parse_decl_type_union(struct ic_token_list *token_list) {
  struct ic_decl *decl = 0;
  if (!token_list) {
    puts("ic_parse_decl_type_struct: token_list was null");
    return 0;
  }
  decl = ic_parse_decl_type_union_header(token_list);
  if (!decl) {
    puts("ic_parse_decl_type_struct: call to ic_parse_decl_type_union_header "
         "failed");
    return 0;
  }
  decl = ic_parse_decl_type_union_body(token_list, decl);
  if (!decl) {
    puts("ic_parse_decl_type_struct: call to ic_parse_decl_type_union_body "
         "failed");
    return 0;
  }
  return decl;
}


x86 assembly (clang, -O0):
<ic_parse_decl_type_union>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1168 <ic_parse_decl_type_union+0x38>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    11d6 <ic_parse_decl_type_union+0xa6>
mov    -0x10(%rbp),%rdi
call   1040 <ic_parse_decl_type_union_header@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1199 <ic_parse_decl_type_union+0x69>
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    11d6 <ic_parse_decl_type_union+0xa6>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <ic_parse_decl_type_union_body@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11ce <ic_parse_decl_type_union+0x9e>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    11d6 <ic_parse_decl_type_union+0xa6>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_parse_decl_type_union>:
push   %rbx
test   %rdi,%rdi
je     1155 <ic_parse_decl_type_union+0x25>
mov    %rdi,%rbx
call   1040 <ic_parse_decl_type_union_header@plt>
test   %rax,%rax
je     115e <ic_parse_decl_type_union+0x2e>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <ic_parse_decl_type_union_body@plt>
test   %rax,%rax
je     1167 <ic_parse_decl_type_union+0x37>
pop    %rbx
ret
lea    0xea4(%rip),%rdi
jmp    116e <ic_parse_decl_type_union+0x3e>
lea    0xeca(%rip),%rdi
jmp    116e <ic_parse_decl_type_union+0x3e>
lea    0xf0b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ic_decl = type { i32 }
%struct.ic_token_list = type { i32 }
@.str = [47 x i8] c"ic_parse_decl_type_struct: token_list was null\00"
@.str.1 = [74 x i8] c"ic_parse_decl_type_struct: call to ic_parse_decl_type_union_header failed\00"
@.str.2 = [72 x i8] c"ic_parse_decl_type_struct: call to ic_parse_decl_type_union_body failed\00"
define %struct.ic_decl* @ic_parse_decl_type_union(%struct.ic_token_list* %0) {
%2 = alloca %struct.ic_decl*
%3 = alloca %struct.ic_token_list*
%4 = alloca %struct.ic_decl*
store %struct.ic_token_list* %0, %struct.ic_token_list** %3
store %struct.ic_decl* null, %struct.ic_decl** %4
%5 = load %struct.ic_token_list*, %struct.ic_token_list** %3
%6 = icmp ne %struct.ic_token_list* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @puts(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
store %struct.ic_decl* null, %struct.ic_decl** %2
br label %26
9: ; preds = %1
%10 = load %struct.ic_token_list*, %struct.ic_token_list** %3
%11 = call %struct.ic_decl* @ic_parse_decl_type_union_header(%struct.ic_token_list* %10)
store %struct.ic_decl* %11, %struct.ic_decl** %4
%12 = load %struct.ic_decl*, %struct.ic_decl** %4
%13 = icmp ne %struct.ic_decl* %12, null
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = call i32 @puts(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
store %struct.ic_decl* null, %struct.ic_decl** %2
br label %26
16: ; preds = %9
%17 = load %struct.ic_token_list*, %struct.ic_token_list** %3
%18 = load %struct.ic_decl*, %struct.ic_decl** %4
%19 = call %struct.ic_decl* @ic_parse_decl_type_union_body(%struct.ic_token_list* %17, %struct.ic_decl* %18)
store %struct.ic_decl* %19, %struct.ic_decl** %4
%20 = load %struct.ic_decl*, %struct.ic_decl** %4
%21 = icmp ne %struct.ic_decl* %20, null
br i1 %21, label %24, label %22
22: ; preds = %16
%23 = call i32 @puts(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.2, i64 0, i64 0))
store %struct.ic_decl* null, %struct.ic_decl** %2
br label %26
24: ; preds = %16
%25 = load %struct.ic_decl*, %struct.ic_decl** %4
store %struct.ic_decl* %25, %struct.ic_decl** %2
br label %26
26: ; preds = %24, %22, %14, %7
%27 = load %struct.ic_decl*, %struct.ic_decl** %2
ret %struct.ic_decl* %27
}

LLVM IR (-O2):
%struct.ic_decl = type { i32 }
%struct.ic_token_list = type { i32 }
@.str = [47 x i8] c"ic_parse_decl_type_struct: token_list was null\00"
@.str.1 = [74 x i8] c"ic_parse_decl_type_struct: call to ic_parse_decl_type_union_header failed\00"
@.str.2 = [72 x i8] c"ic_parse_decl_type_struct: call to ic_parse_decl_type_union_body failed\00"
define %struct.ic_decl* @ic_parse_decl_type_union(%struct.ic_token_list* %0) {
%2 = icmp eq %struct.ic_token_list* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call %struct.ic_decl* @ic_parse_decl_type_union_header(%struct.ic_token_list* %0)
%5 = icmp eq %struct.ic_decl* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call %struct.ic_decl* @ic_parse_decl_type_union_body(%struct.ic_token_list* %0, %struct.ic_decl* %4)
%8 = icmp eq %struct.ic_decl* %7, null
br i1 %8, label %9, label %12
9: ; preds = %6, %3, %1
%10 = phi i8* [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([72 x i8], [72 x i8]* @.str.2, i64 0, i64 0), %6 ]
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
br label %12
12: ; preds = %9, %6
%13 = phi %struct.ic_decl* [ %7, %6 ], [ null, %9 ]
ret %struct.ic_decl* %13
}