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

/* Variables and functions */
int /*<<< orphan*/ ic_parse_type_ref_embedded(struct ic_type_ref *,
                                              struct ic_token_list *);
struct ic_type_ref *ic_type_ref_new();
int /*<<< orphan*/ puts(char *);
struct ic_type_ref *ic_parse_type_ref(struct ic_token_list *token_list) {
  struct ic_type_ref *tref = 0;
  tref = ic_type_ref_new();
  if (!tref) {
    puts("ic_parse_type_ref: call to ic_type_ref_new failed");
    return 0;
  }
  if (!ic_parse_type_ref_embedded(tref, token_list)) {
    puts("ic_parse_type_ref: call to ic_parse_type_ref_embedded failed");
    return 0;
  }
  return tref;
}


x86 assembly (clang, -O0):
<ic_parse_type_ref>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1050 <ic_type_ref_new@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1173 <ic_parse_type_ref+0x43>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    11aa <ic_parse_type_ref+0x7a>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <ic_parse_type_ref_embedded@plt>
cmp    $0x0,%eax
jne    11a2 <ic_parse_type_ref+0x72>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    11aa <ic_parse_type_ref+0x7a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_parse_type_ref>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <ic_type_ref_new@plt>
test   %rax,%rax
je     115e <ic_parse_type_ref+0x2e>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <ic_parse_type_ref_embedded@plt>
test   %eax,%eax
jne    116c <ic_parse_type_ref+0x3c>
lea    0xed6(%rip),%rdi
jmp    1165 <ic_parse_type_ref+0x35>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ic_type_ref = type { i32 }
%struct.ic_token_list = type { i32 }
@.str = [50 x i8] c"ic_parse_type_ref: call to ic_type_ref_new failed\00"
@.str.1 = [61 x i8] c"ic_parse_type_ref: call to ic_parse_type_ref_embedded failed\00"
define %struct.ic_type_ref* @ic_parse_type_ref(%struct.ic_token_list* %0) {
%2 = alloca %struct.ic_type_ref*
%3 = alloca %struct.ic_token_list*
%4 = alloca %struct.ic_type_ref*
store %struct.ic_token_list* %0, %struct.ic_token_list** %3
store %struct.ic_type_ref* null, %struct.ic_type_ref** %4
%5 = call %struct.ic_type_ref* (...) @ic_type_ref_new()
store %struct.ic_type_ref* %5, %struct.ic_type_ref** %4
%6 = load %struct.ic_type_ref*, %struct.ic_type_ref** %4
%7 = icmp ne %struct.ic_type_ref* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @puts(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
store %struct.ic_type_ref* null, %struct.ic_type_ref** %2
br label %19
10: ; preds = %1
%11 = load %struct.ic_type_ref*, %struct.ic_type_ref** %4
%12 = load %struct.ic_token_list*, %struct.ic_token_list** %3
%13 = call i32 @ic_parse_type_ref_embedded(%struct.ic_type_ref* %11, %struct.ic_token_list* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %10
%16 = call i32 @puts(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0))
store %struct.ic_type_ref* null, %struct.ic_type_ref** %2
br label %19
17: ; preds = %10
%18 = load %struct.ic_type_ref*, %struct.ic_type_ref** %4
store %struct.ic_type_ref* %18, %struct.ic_type_ref** %2
br label %19
19: ; preds = %17, %15, %8
%20 = load %struct.ic_type_ref*, %struct.ic_type_ref** %2
ret %struct.ic_type_ref* %20
}

LLVM IR (-O2):
%struct.ic_type_ref = type { i32 }
%struct.ic_token_list = type { i32 }
@.str = [50 x i8] c"ic_parse_type_ref: call to ic_type_ref_new failed\00"
@.str.1 = [61 x i8] c"ic_parse_type_ref: call to ic_parse_type_ref_embedded failed\00"
define %struct.ic_type_ref* @ic_parse_type_ref(%struct.ic_token_list* %0) {
%2 = tail call %struct.ic_type_ref* (...) @ic_type_ref_new()
%3 = icmp eq %struct.ic_type_ref* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @ic_parse_type_ref_embedded(%struct.ic_type_ref* %2, %struct.ic_token_list* %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4, %1
%8 = phi i8* [ getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), %4 ]
%9 = tail call i32 @puts(i8* dereferenceable(1) %8)
br label %10
10: ; preds = %7, %4
%11 = phi %struct.ic_type_ref* [ %2, %4 ], [ null, %7 ]
ret %struct.ic_type_ref* %11
}