int main(void) {
  struct lnode *root = mklnode('a', 8);
  struct lnode *c2 = inslnode('c', 2, root);
  displist(root);
  printf("\n");
  struct lnode *c1 = inslnode('b', 5, root);
  incfreq(c2);
  displist(root);
  printf("\n");
  printf("a exists? %p\n", findlnode(root, 'a'));
  printf("b exists? %p\n", findlnode(root, 'b'));
  printf("c exists? %p\n", findlnode(root, 'c'));
  printf("k exists? %p\n", findlnode(root, 'k'));
  printf("\n");
  remlnode(&c2);
  remlnode(&c1);
  remlnode(&root);
  printf("after free():\n");
  printf("root: %x\n", root);
  printf("c1  : %x\n", c1);
  printf("c2  : %x\n", c2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x61,%edi
mov    $0x8,%esi
mov    $0x0,%al
call   1050 <mklnode@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    $0x63,%edi
mov    $0x2,%esi
mov    $0x0,%al
call   1090 <inslnode@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1070 <displist@plt>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdx
mov    $0x62,%edi
mov    $0x5,%esi
mov    $0x0,%al
call   1090 <inslnode@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1040 <incfreq@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1070 <displist@plt>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x61,%esi
mov    $0x0,%al
call   1080 <findlnode@plt>
mov    %eax,%esi
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x62,%esi
mov    $0x0,%al
call   1080 <findlnode@plt>
mov    %eax,%esi
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x63,%esi
mov    $0x0,%al
call   1080 <findlnode@plt>
mov    %eax,%esi
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6b,%esi
mov    $0x0,%al
call   1080 <findlnode@plt>
mov    %eax,%esi
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1030 <remlnode@plt>
lea    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1030 <remlnode@plt>
lea    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <remlnode@plt>
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xd6e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    $0x61,%edi
mov    $0x8,%esi
xor    %eax,%eax
call   1070 <mklnode@plt>
movslq %eax,%rbx
mov    %rbx,0x10(%rsp)
mov    $0x63,%edi
mov    $0x2,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <inslnode@plt>
movslq %eax,%r14
mov    %r14,0x8(%rsp)
mov    %rbx,%rdi
xor    %eax,%eax
call   1090 <displist@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x62,%edi
mov    $0x5,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <inslnode@plt>
cltq
mov    %rax,(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <incfreq@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1090 <displist@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x61,%esi
xor    %eax,%eax
call   10a0 <findlnode@plt>
lea    0xdd2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
mov    $0x62,%esi
xor    %eax,%eax
call   10a0 <findlnode@plt>
lea    0xdc1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
mov    $0x63,%esi
xor    %eax,%eax
call   10a0 <findlnode@plt>
lea    0xdb0(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
mov    $0x6b,%esi
xor    %eax,%eax
call   10a0 <findlnode@plt>
lea    0xd9f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x8(%rsp),%rdi
xor    %eax,%eax
call   1050 <remlnode@plt>
mov    %rsp,%rdi
xor    %eax,%eax
call   1050 <remlnode@plt>
lea    0x10(%rsp),%rdi
xor    %eax,%eax
call   1050 <remlnode@plt>
lea    0xd8f(%rip),%rdi
call   1040 <puts@plt>
mov    0x10(%rsp),%rsi
lea    0xd60(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    (%rsp),%rsi
lea    0xd58(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%rsp),%rsi
lea    0xd4f(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.lnode = type opaque
@.str = [2 x i8] c"\0A\00"
@.str.1 = [14 x i8] c"a exists? %p\0A\00"
@.str.2 = [14 x i8] c"b exists? %p\0A\00"
@.str.3 = [14 x i8] c"c exists? %p\0A\00"
@.str.4 = [14 x i8] c"k exists? %p\0A\00"
@.str.5 = [15 x i8] c"after free():\0A\00"
@.str.6 = [10 x i8] c"root: %x\0A\00"
@.str.7 = [10 x i8] c"c1 : %x\0A\00"
@.str.8 = [10 x i8] c"c2 : %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.lnode*
%3 = alloca %struct.lnode*
%4 = alloca %struct.lnode*
store i32 0, i32* %1
%5 = call i32 (i32, i32, ...) bitcast (i32 (...)* @mklnode to i32 (i32, i32, ...)*)(i32 97, i32 8)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to %struct.lnode*
store %struct.lnode* %7, %struct.lnode** %2
%8 = load %struct.lnode*, %struct.lnode** %2
%9 = call i32 (i32, i32, %struct.lnode*, ...) bitcast (i32 (...)* @inslnode to i32 (i32, i32, %struct.lnode*, ...)*)(i32 99, i32 2, %struct.lnode* %8)
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to %struct.lnode*
store %struct.lnode* %11, %struct.lnode** %3
%12 = load %struct.lnode*, %struct.lnode** %2
%13 = call i32 (%struct.lnode*, ...) bitcast (i32 (...)* @displist to i32 (%struct.lnode*, ...)*)(%struct.lnode* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = load %struct.lnode*, %struct.lnode** %2
%16 = call i32 (i32, i32, %struct.lnode*, ...) bitcast (i32 (...)* @inslnode to i32 (i32, i32, %struct.lnode*, ...)*)(i32 98, i32 5, %struct.lnode* %15)
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to %struct.lnode*
store %struct.lnode* %18, %struct.lnode** %4
%19 = load %struct.lnode*, %struct.lnode** %3
%20 = call i32 (%struct.lnode*, ...) bitcast (i32 (...)* @incfreq to i32 (%struct.lnode*, ...)*)(%struct.lnode* %19)
%21 = load %struct.lnode*, %struct.lnode** %2
%22 = call i32 (%struct.lnode*, ...) bitcast (i32 (...)* @displist to i32 (%struct.lnode*, ...)*)(%struct.lnode* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = load %struct.lnode*, %struct.lnode** %2
%25 = call i32 (%struct.lnode*, i32, ...) bitcast (i32 (...)* @findlnode to i32 (%struct.lnode*, i32, ...)*)(%struct.lnode* %24, i32 97)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load %struct.lnode*, %struct.lnode** %2
%28 = call i32 (%struct.lnode*, i32, ...) bitcast (i32 (...)* @findlnode to i32 (%struct.lnode*, i32, ...)*)(%struct.lnode* %27, i32 98)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = load %struct.lnode*, %struct.lnode** %2
%31 = call i32 (%struct.lnode*, i32, ...) bitcast (i32 (...)* @findlnode to i32 (%struct.lnode*, i32, ...)*)(%struct.lnode* %30, i32 99)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%33 = load %struct.lnode*, %struct.lnode** %2
%34 = call i32 (%struct.lnode*, i32, ...) bitcast (i32 (...)* @findlnode to i32 (%struct.lnode*, i32, ...)*)(%struct.lnode* %33, i32 107)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%37 = call i32 (%struct.lnode**, ...) bitcast (i32 (...)* @remlnode to i32 (%struct.lnode**, ...)*)(%struct.lnode** %3)
%38 = call i32 (%struct.lnode**, ...) bitcast (i32 (...)* @remlnode to i32 (%struct.lnode**, ...)*)(%struct.lnode** %4)
%39 = call i32 (%struct.lnode**, ...) bitcast (i32 (...)* @remlnode to i32 (%struct.lnode**, ...)*)(%struct.lnode** %2)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%41 = load %struct.lnode*, %struct.lnode** %2
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), %struct.lnode* %41)
%43 = load %struct.lnode*, %struct.lnode** %4
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), %struct.lnode* %43)
%45 = load %struct.lnode*, %struct.lnode** %3
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), %struct.lnode* %45)
ret i32 0
}

LLVM IR (-O2):
%struct.lnode = type opaque
@.str.1 = [14 x i8] c"a exists? %p\0A\00"
@.str.2 = [14 x i8] c"b exists? %p\0A\00"
@.str.3 = [14 x i8] c"c exists? %p\0A\00"
@.str.4 = [14 x i8] c"k exists? %p\0A\00"
@.str.6 = [10 x i8] c"root: %x\0A\00"
@.str.7 = [10 x i8] c"c1 : %x\0A\00"
@.str.8 = [10 x i8] c"c2 : %x\0A\00"
@str = [14 x i8] c"after free():\00"
define i32 @main() {
%1 = alloca %struct.lnode*
%2 = alloca %struct.lnode*
%3 = alloca %struct.lnode*
%4 = bitcast %struct.lnode** %1 to i8*
%5 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @mklnode to i32 (i32, i32, ...)*)(i32 97, i32 8)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to %struct.lnode*
store %struct.lnode* %7, %struct.lnode** %1
%8 = bitcast %struct.lnode** %2 to i8*
%9 = tail call i32 (i32, i32, %struct.lnode*, ...) bitcast (i32 (...)* @inslnode to i32 (i32, i32, %struct.lnode*, ...)*)(i32 99, i32 2, %struct.lnode* %7)
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to %struct.lnode*
store %struct.lnode* %11, %struct.lnode** %2
%12 = tail call i32 (%struct.lnode*, ...) bitcast (i32 (...)* @displist to i32 (%struct.lnode*, ...)*)(%struct.lnode* %7)
%13 = tail call i32 @putchar(i32 10)
%14 = bitcast %struct.lnode** %3 to i8*
%15 = tail call i32 (i32, i32, %struct.lnode*, ...) bitcast (i32 (...)* @inslnode to i32 (i32, i32, %struct.lnode*, ...)*)(i32 98, i32 5, %struct.lnode* %7)
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to %struct.lnode*
store %struct.lnode* %17, %struct.lnode** %3
%18 = tail call i32 (%struct.lnode*, ...) bitcast (i32 (...)* @incfreq to i32 (%struct.lnode*, ...)*)(%struct.lnode* %11)
%19 = tail call i32 (%struct.lnode*, ...) bitcast (i32 (...)* @displist to i32 (%struct.lnode*, ...)*)(%struct.lnode* %7)
%20 = tail call i32 @putchar(i32 10)
%21 = tail call i32 (%struct.lnode*, i32, ...) bitcast (i32 (...)* @findlnode to i32 (%struct.lnode*, i32, ...)*)(%struct.lnode* %7, i32 97)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = tail call i32 (%struct.lnode*, i32, ...) bitcast (i32 (...)* @findlnode to i32 (%struct.lnode*, i32, ...)*)(%struct.lnode* %7, i32 98)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = tail call i32 (%struct.lnode*, i32, ...) bitcast (i32 (...)* @findlnode to i32 (%struct.lnode*, i32, ...)*)(%struct.lnode* %7, i32 99)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%27 = tail call i32 (%struct.lnode*, i32, ...) bitcast (i32 (...)* @findlnode to i32 (%struct.lnode*, i32, ...)*)(%struct.lnode* %7, i32 107)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %27)
%29 = tail call i32 @putchar(i32 10)
%30 = call i32 (%struct.lnode**, ...) bitcast (i32 (...)* @remlnode to i32 (%struct.lnode**, ...)*)(%struct.lnode** %2)
%31 = call i32 (%struct.lnode**, ...) bitcast (i32 (...)* @remlnode to i32 (%struct.lnode**, ...)*)(%struct.lnode** %3)
%32 = call i32 (%struct.lnode**, ...) bitcast (i32 (...)* @remlnode to i32 (%struct.lnode**, ...)*)(%struct.lnode** %1)
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%34 = load %struct.lnode*, %struct.lnode** %1
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), %struct.lnode* %34)
%36 = load %struct.lnode*, %struct.lnode** %3
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), %struct.lnode* %36)
%38 = load %struct.lnode*, %struct.lnode** %2
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), %struct.lnode* %38)
ret i32 0
}