#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_symbol {
  int dummy;
};

/* Variables and functions */
char *ic_symbol_contents(struct ic_symbol *);
unsigned int ic_symbol_equal_char(struct ic_symbol *, char *);
int /*<<< orphan*/ puts(char *);
unsigned int ic_symbol_equal(struct ic_symbol *a, struct ic_symbol *b) {
  char *b_ch = 0;
  if (!a) {
    puts("ic_symbol_equal: a was null");
    return 0;
  }
  if (!b) {
    puts("ic_symbol_equal: b was null");
    return 0;
  }
  b_ch = ic_symbol_contents(b);
  if (!b_ch) {
    puts("ic_symbol_equal: call to ic_symbol_contents failed");
    return 0;
  }
  return ic_symbol_equal_char(a, b_ch);
}


x86 assembly (clang, -O0):
<ic_symbol_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116b <ic_symbol_equal+0x3b>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ce <ic_symbol_equal+0x9e>
cmpq   $0x0,-0x18(%rbp)
jne    118e <ic_symbol_equal+0x5e>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ce <ic_symbol_equal+0x9e>
mov    -0x18(%rbp),%rdi
call   1040 <ic_symbol_contents@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11be <ic_symbol_equal+0x8e>
lea    0xe8b(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ce <ic_symbol_equal+0x9e>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <ic_symbol_equal_char@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_symbol_equal>:
push   %rbx
test   %rdi,%rdi
je     1157 <ic_symbol_equal+0x27>
test   %rsi,%rsi
je     1160 <ic_symbol_equal+0x30>
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <ic_symbol_contents@plt>
test   %rax,%rax
je     1169 <ic_symbol_equal+0x39>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1050 <ic_symbol_equal_char@plt>
lea    0xea2(%rip),%rdi
jmp    1170 <ic_symbol_equal+0x40>
lea    0xeb5(%rip),%rdi
jmp    1170 <ic_symbol_equal+0x40>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.ic_symbol = type { i32 }
@.str = [28 x i8] c"ic_symbol_equal: a was null\00"
@.str.1 = [28 x i8] c"ic_symbol_equal: b was null\00"
@.str.2 = [51 x i8] c"ic_symbol_equal: call to ic_symbol_contents failed\00"
define i32 @ic_symbol_equal(%struct.ic_symbol* %0, %struct.ic_symbol* %1) {
%3 = icmp eq %struct.ic_symbol* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %17
6: ; preds = %2
%7 = icmp eq %struct.ic_symbol* %1, null
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %17
10: ; preds = %6
%11 = tail call i8* @ic_symbol_contents(%struct.ic_symbol* %1)
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
br label %17
15: ; preds = %10
%16 = tail call i32 @ic_symbol_equal_char(%struct.ic_symbol* %0, i8* %11)
br label %17
17: ; preds = %15, %13, %8, %4
%18 = phi i32 [ %16, %15 ], [ 0, %13 ], [ 0, %8 ], [ 0, %4 ]
ret i32 %18
}