#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 /*<<< orphan*/ ic_symbol_contents(struct ic_symbol *);
int ic_symbol_destroy(struct ic_symbol *, int);
char ic_symbol_get(struct ic_symbol *, int);
int ic_symbol_length(struct ic_symbol *);
struct ic_symbol *ic_symbol_new(char *, int);
int /*<<< orphan*/ ic_symbol_print(int /*<<< orphan*/, struct ic_symbol *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strncmp(char *, int /*<<< orphan*/, int);
void normal(void) {
  int i;
  struct ic_symbol *str = ic_symbol_new("hello", 5);
  puts("ignore any text output, testing error cases");
  assert(str);
  assert(ic_symbol_length(str) == 5);
  assert(!strncmp("hello", ic_symbol_contents(str), 5));
  assert(ic_symbol_get(str, 0) == 'h');
  assert(ic_symbol_get(str, 1) == 'e');
  assert(ic_symbol_get(str, 2) == 'l');
  assert(ic_symbol_get(str, 3) == 'l');
  assert(ic_symbol_get(str, 4) == 'o');
  assert(ic_symbol_get(str, 5) == 0);
  assert(ic_symbol_get(str, 6) == 0);
  assert(ic_symbol_get(str, 7) == 0);
  ic_symbol_print(stdout, str);
  assert(1 == ic_symbol_destroy(str, 1));
}


x86 assembly (clang, -O0):
<normal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe61(%rip),%rdi
mov    $0x5,%esi
call   10b0 <ic_symbol_new@plt>
mov    %rax,-0x10(%rbp)
lea    0xe52(%rip),%rdi
call   1050 <puts@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
call   1090 <assert@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <ic_symbol_length@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1070 <ic_symbol_contents@plt>
mov    %eax,%esi
lea    0xe11(%rip),%rdi
mov    $0x5,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1080 <ic_symbol_get@plt>
movsbl %al,%eax
cmp    $0x68,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1080 <ic_symbol_get@plt>
movsbl %al,%eax
cmp    $0x65,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1080 <ic_symbol_get@plt>
movsbl %al,%eax
cmp    $0x6c,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1080 <ic_symbol_get@plt>
movsbl %al,%eax
cmp    $0x6c,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1080 <ic_symbol_get@plt>
movsbl %al,%eax
cmp    $0x6f,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1080 <ic_symbol_get@plt>
movsbl %al,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6,%esi
call   1080 <ic_symbol_get@plt>
movsbl %al,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x7,%esi
call   1080 <ic_symbol_get@plt>
movsbl %al,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1030 <ic_symbol_print@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1060 <ic_symbol_destroy@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normal>:
push   %r14
push   %rbx
push   %rax
lea    0xe65(%rip),%r14
mov    %r14,%rdi
mov    $0x5,%esi
call   10b0 <ic_symbol_new@plt>
mov    %rax,%rbx
lea    0xe54(%rip),%rdi
call   1050 <puts@plt>
mov    %ebx,%edi
call   1090 <assert@plt>
mov    %rbx,%rdi
call   10a0 <ic_symbol_length@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1090 <assert@plt>
mov    %rbx,%rdi
call   1070 <ic_symbol_contents@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x5,%edx
call   1040 <strncmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1090 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <ic_symbol_get@plt>
xor    %edi,%edi
cmp    $0x68,%al
sete   %dil
call   1090 <assert@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1080 <ic_symbol_get@plt>
xor    %edi,%edi
cmp    $0x65,%al
sete   %dil
call   1090 <assert@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1080 <ic_symbol_get@plt>
xor    %edi,%edi
cmp    $0x6c,%al
sete   %dil
call   1090 <assert@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1080 <ic_symbol_get@plt>
xor    %edi,%edi
cmp    $0x6c,%al
sete   %dil
call   1090 <assert@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1080 <ic_symbol_get@plt>
xor    %edi,%edi
cmp    $0x6f,%al
sete   %dil
call   1090 <assert@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1080 <ic_symbol_get@plt>
xor    %edi,%edi
test   %al,%al
sete   %dil
call   1090 <assert@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1080 <ic_symbol_get@plt>
xor    %edi,%edi
test   %al,%al
sete   %dil
call   1090 <assert@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1080 <ic_symbol_get@plt>
xor    %edi,%edi
test   %al,%al
sete   %dil
call   1090 <assert@plt>
mov    0x2d14(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <ic_symbol_print@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1060 <ic_symbol_destroy@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1090 <assert@plt>

LLVM IR (-O0):
%struct.ic_symbol = type { i32 }
@.str = [6 x i8] c"hello\00"
@.str.1 = [44 x i8] c"ignore any text output, testing error cases\00"
@stdout = global i32 0
define void @normal() {
%1 = alloca i32
%2 = alloca %struct.ic_symbol*
%3 = call %struct.ic_symbol* @ic_symbol_new(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
store %struct.ic_symbol* %3, %struct.ic_symbol** %2
%4 = call i32 @puts(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%5 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%6 = ptrtoint %struct.ic_symbol* %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%9 = call i32 @ic_symbol_length(%struct.ic_symbol* %8)
%10 = icmp eq i32 %9, 5
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%14 = call i32 @ic_symbol_contents(%struct.ic_symbol* %13)
%15 = call i32 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %14, i32 5)
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%21 = call signext i8 @ic_symbol_get(%struct.ic_symbol* %20, i32 0)
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 104
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%27 = call signext i8 @ic_symbol_get(%struct.ic_symbol* %26, i32 1)
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 101
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%33 = call signext i8 @ic_symbol_get(%struct.ic_symbol* %32, i32 2)
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 108
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%39 = call signext i8 @ic_symbol_get(%struct.ic_symbol* %38, i32 3)
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 108
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%45 = call signext i8 @ic_symbol_get(%struct.ic_symbol* %44, i32 4)
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 111
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%51 = call signext i8 @ic_symbol_get(%struct.ic_symbol* %50, i32 5)
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 0
%54 = zext i1 %53 to i32
%55 = call i32 @assert(i32 %54)
%56 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%57 = call signext i8 @ic_symbol_get(%struct.ic_symbol* %56, i32 6)
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 0
%60 = zext i1 %59 to i32
%61 = call i32 @assert(i32 %60)
%62 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%63 = call signext i8 @ic_symbol_get(%struct.ic_symbol* %62, i32 7)
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 0
%66 = zext i1 %65 to i32
%67 = call i32 @assert(i32 %66)
%68 = load i32, i32* @stdout
%69 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%70 = call i32 @ic_symbol_print(i32 %68, %struct.ic_symbol* %69)
%71 = load %struct.ic_symbol*, %struct.ic_symbol** %2
%72 = call i32 @ic_symbol_destroy(%struct.ic_symbol* %71, i32 1)
%73 = icmp eq i32 1, %72
%74 = zext i1 %73 to i32
%75 = call i32 @assert(i32 %74)
ret void
}

LLVM IR (-O2):
%struct.ic_symbol = type { i32 }
@.str = [6 x i8] c"hello\00"
@.str.1 = [44 x i8] c"ignore any text output, testing error cases\00"
@stdout = global i32 0
define void @normal() {
%1 = tail call %struct.ic_symbol* @ic_symbol_new(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%3 = ptrtoint %struct.ic_symbol* %1 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @ic_symbol_length(%struct.ic_symbol* %1)
%7 = icmp eq i32 %6, 5
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 @ic_symbol_contents(%struct.ic_symbol* %1)
%11 = tail call i32 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10, i32 5)
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call signext i8 @ic_symbol_get(%struct.ic_symbol* %1, i32 0)
%16 = icmp eq i8 %15, 104
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = tail call signext i8 @ic_symbol_get(%struct.ic_symbol* %1, i32 1)
%20 = icmp eq i8 %19, 101
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call signext i8 @ic_symbol_get(%struct.ic_symbol* %1, i32 2)
%24 = icmp eq i8 %23, 108
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = tail call signext i8 @ic_symbol_get(%struct.ic_symbol* %1, i32 3)
%28 = icmp eq i8 %27, 108
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = tail call signext i8 @ic_symbol_get(%struct.ic_symbol* %1, i32 4)
%32 = icmp eq i8 %31, 111
%33 = zext i1 %32 to i32
%34 = tail call i32 @assert(i32 %33)
%35 = tail call signext i8 @ic_symbol_get(%struct.ic_symbol* %1, i32 5)
%36 = icmp eq i8 %35, 0
%37 = zext i1 %36 to i32
%38 = tail call i32 @assert(i32 %37)
%39 = tail call signext i8 @ic_symbol_get(%struct.ic_symbol* %1, i32 6)
%40 = icmp eq i8 %39, 0
%41 = zext i1 %40 to i32
%42 = tail call i32 @assert(i32 %41)
%43 = tail call signext i8 @ic_symbol_get(%struct.ic_symbol* %1, i32 7)
%44 = icmp eq i8 %43, 0
%45 = zext i1 %44 to i32
%46 = tail call i32 @assert(i32 %45)
%47 = load i32, i32* @stdout
%48 = tail call i32 @ic_symbol_print(i32 %47, %struct.ic_symbol* %1)
%49 = tail call i32 @ic_symbol_destroy(%struct.ic_symbol* %1, i32 1)
%50 = icmp eq i32 %49, 1
%51 = zext i1 %50 to i32
%52 = tail call i32 @assert(i32 %51)
ret void
}