#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 */
int /*<<< orphan*/ assert(int);
int ic_symbol_destroy(struct ic_symbol *, int);
int ic_symbol_equal(struct ic_symbol *, struct ic_symbol *);
int ic_symbol_equal_char(struct ic_symbol *, char *);
struct ic_symbol *ic_symbol_new(char *, int);
void equality(void) {
  struct ic_symbol *sym1 = 0;
  struct ic_symbol *sym2 = 0;
  sym1 = ic_symbol_new("Hello world", 11);
  assert(sym1);
  sym2 = ic_symbol_new("Hello world", 11);
  assert(sym2);
  assert(1 == ic_symbol_equal(sym1, sym2));
  assert(1 == ic_symbol_equal_char(sym1, "Hello world"));
  assert(0 == ic_symbol_equal_char(sym1, "Hello world."));
  assert(1 == ic_symbol_destroy(sym1, 1));
  assert(1 == ic_symbol_destroy(sym2, 1));
}


x86 assembly (clang, -O0):
<equality>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xe91(%rip),%rdi
mov    $0xb,%esi
call   1060 <ic_symbol_new@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%edi
call   1040 <assert@plt>
lea    0xe71(%rip),%rdi
mov    $0xb,%esi
call   1060 <ic_symbol_new@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <ic_symbol_equal@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1050 <ic_symbol_equal_char@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    0xe10(%rip),%rsi
call   1050 <ic_symbol_equal_char@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <ic_symbol_destroy@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <ic_symbol_destroy@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equality>:
push   %r15
push   %r14
push   %rbx
lea    0xea4(%rip),%r15
mov    %r15,%rdi
mov    $0xb,%esi
call   1060 <ic_symbol_new@plt>
mov    %rax,%rbx
mov    %ebx,%edi
call   1040 <assert@plt>
mov    %r15,%rdi
mov    $0xb,%esi
call   1060 <ic_symbol_new@plt>
mov    %rax,%r14
mov    %r14d,%edi
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <ic_symbol_equal@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <ic_symbol_equal_char@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe48(%rip),%rsi
mov    %rbx,%rdi
call   1050 <ic_symbol_equal_char@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <ic_symbol_destroy@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <ic_symbol_destroy@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <assert@plt>

LLVM IR (-O0):
%struct.ic_symbol = type { i32 }
@.str = [12 x i8] c"Hello world\00"
@.str.1 = [13 x i8] c"Hello world.\00"
define void @equality() {
%1 = alloca %struct.ic_symbol*
%2 = alloca %struct.ic_symbol*
store %struct.ic_symbol* null, %struct.ic_symbol** %1
store %struct.ic_symbol* null, %struct.ic_symbol** %2
%3 = call %struct.ic_symbol* @ic_symbol_new(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 11)
store %struct.ic_symbol* %3, %struct.ic_symbol** %1
%4 = load %struct.ic_symbol*, %struct.ic_symbol** %1
%5 = ptrtoint %struct.ic_symbol* %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = call %struct.ic_symbol* @ic_symbol_new(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 11)
store %struct.ic_symbol* %7, %struct.ic_symbol** %2
%8 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%9 = ptrtoint %struct.ic_symbol* %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load %struct.ic_symbol*, %struct.ic_symbol** %1
%12 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%13 = call i32 @ic_symbol_equal(%struct.ic_symbol* %11, %struct.ic_symbol* %12)
%14 = icmp eq i32 1, %13
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load %struct.ic_symbol*, %struct.ic_symbol** %1
%18 = call i32 @ic_symbol_equal_char(%struct.ic_symbol* %17, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i32 1, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load %struct.ic_symbol*, %struct.ic_symbol** %1
%23 = call i32 @ic_symbol_equal_char(%struct.ic_symbol* %22, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i32 0, %23
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load %struct.ic_symbol*, %struct.ic_symbol** %1
%28 = call i32 @ic_symbol_destroy(%struct.ic_symbol* %27, i32 1)
%29 = icmp eq i32 1, %28
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%33 = call i32 @ic_symbol_destroy(%struct.ic_symbol* %32, i32 1)
%34 = icmp eq i32 1, %33
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
ret void
}

LLVM IR (-O2):
%struct.ic_symbol = type { i32 }
@.str = [12 x i8] c"Hello world\00"
@.str.1 = [13 x i8] c"Hello world.\00"
define void @equality() {
%1 = tail call %struct.ic_symbol* @ic_symbol_new(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 11)
%2 = ptrtoint %struct.ic_symbol* %1 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call %struct.ic_symbol* @ic_symbol_new(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 11)
%6 = ptrtoint %struct.ic_symbol* %5 to i64
%7 = trunc i64 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @ic_symbol_equal(%struct.ic_symbol* %1, %struct.ic_symbol* %5)
%10 = icmp eq i32 %9, 1
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @ic_symbol_equal_char(%struct.ic_symbol* %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32 %13, 1
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i32 @ic_symbol_equal_char(%struct.ic_symbol* %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = tail call i32 @ic_symbol_destroy(%struct.ic_symbol* %1, i32 1)
%22 = icmp eq i32 %21, 1
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = tail call i32 @ic_symbol_destroy(%struct.ic_symbol* %5, i32 1)
%26 = icmp eq i32 %25, 1
%27 = zext i1 %26 to i32
%28 = tail call i32 @assert(i32 %27)
ret void
}