#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 */

/* Variables and functions */
int /*<<< orphan*/ first_element_artist(char *);
int /*<<< orphan*/ free_list();
int /*<<< orphan*/ free_node(int /*<<< orphan*/);
int /*<<< orphan*/ populate();
int /*<<< orphan*/ print_entries_all();
int /*<<< orphan*/ printf(char *);
void test_free_node() {
  printf(
      "====================================================================\n");
  printf("TESTING FREE NODE...\n");
  populate();
  print_entries_all();
  printf("REMOVING NODES...\n");
  free_node(first_element_artist("donny osmond"));
  free_node(first_element_artist("lin manuel miranda"));
  free_node(first_element_artist("sia"));
  free_node(first_element_artist("t"));
  free_node(first_element_artist("taylor swift"));
  free_node(first_element_artist("taylor swift"));
  printf("RESULTS:\n");
  print_entries_all();
  free_list();
  print_entries_all();
}


x86 assembly (clang, -O0):
<test_free_node>:
push   %rbp
mov    %rsp,%rbp
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <populate@plt>
mov    $0x0,%al
call   1030 <print_entries_all@plt>
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
call   1070 <first_element_artist@plt>
mov    %eax,%edi
call   1080 <free_node@plt>
lea    0xecc(%rip),%rdi
call   1070 <first_element_artist@plt>
mov    %eax,%edi
call   1080 <free_node@plt>
lea    0xecc(%rip),%rdi
call   1070 <first_element_artist@plt>
mov    %eax,%edi
call   1080 <free_node@plt>
lea    0xec8(%rip),%rdi
call   1070 <first_element_artist@plt>
mov    %eax,%edi
call   1080 <free_node@plt>
lea    0xeaa(%rip),%rdi
call   1070 <first_element_artist@plt>
mov    %eax,%edi
call   1080 <free_node@plt>
lea    0xe97(%rip),%rdi
call   1070 <first_element_artist@plt>
mov    %eax,%edi
call   1080 <free_node@plt>
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <print_entries_all@plt>
mov    $0x0,%al
call   1060 <free_list@plt>
mov    $0x0,%al
call   1030 <print_entries_all@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_free_node>:
push   %rbx
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <populate@plt>
xor    %eax,%eax
call   1040 <print_entries_all@plt>
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe66(%rip),%rdi
call   1070 <first_element_artist@plt>
mov    %eax,%edi
call   1080 <free_node@plt>
lea    0xe60(%rip),%rdi
call   1070 <first_element_artist@plt>
mov    %eax,%edi
call   1080 <free_node@plt>
lea    0xe60(%rip),%rdi
call   1070 <first_element_artist@plt>
mov    %eax,%edi
call   1080 <free_node@plt>
lea    0xe5c(%rip),%rdi
call   1070 <first_element_artist@plt>
mov    %eax,%edi
call   1080 <free_node@plt>
lea    0xe3e(%rip),%rbx
mov    %rbx,%rdi
call   1070 <first_element_artist@plt>
mov    %eax,%edi
call   1080 <free_node@plt>
mov    %rbx,%rdi
call   1070 <first_element_artist@plt>
mov    %eax,%edi
call   1080 <free_node@plt>
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <print_entries_all@plt>
xor    %eax,%eax
call   1060 <free_list@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <print_entries_all@plt>

LLVM IR (-O0):
@.str = [70 x i8] c"====================================================================\0A\00"
@.str.1 = [22 x i8] c"TESTING FREE NODE...\0A\00"
@.str.2 = [19 x i8] c"REMOVING NODES...\0A\00"
@.str.3 = [13 x i8] c"donny osmond\00"
@.str.4 = [19 x i8] c"lin manuel miranda\00"
@.str.5 = [4 x i8] c"sia\00"
@.str.6 = [2 x i8] c"t\00"
@.str.7 = [13 x i8] c"taylor swift\00"
@.str.8 = [10 x i8] c"RESULTS:\0A\00"
define void @test_free_node() {
%1 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @populate()
%4 = call i32 (...) @print_entries_all()
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @first_element_artist(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @free_node(i32 %6)
%8 = call i32 @first_element_artist(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @free_node(i32 %8)
%10 = call i32 @first_element_artist(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @free_node(i32 %10)
%12 = call i32 @first_element_artist(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @free_node(i32 %12)
%14 = call i32 @first_element_artist(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%15 = call i32 @free_node(i32 %14)
%16 = call i32 @first_element_artist(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%17 = call i32 @free_node(i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 (...) @print_entries_all()
%20 = call i32 (...) @free_list()
%21 = call i32 (...) @print_entries_all()
ret void
}

LLVM IR (-O2):
@.str.3 = [13 x i8] c"donny osmond\00"
@.str.4 = [19 x i8] c"lin manuel miranda\00"
@.str.5 = [4 x i8] c"sia\00"
@.str.6 = [2 x i8] c"t\00"
@.str.7 = [13 x i8] c"taylor swift\00"
@str = [69 x i8] c"====================================================================\00"
@str.9 = [21 x i8] c"TESTING FREE NODE...\00"
@str.10 = [18 x i8] c"REMOVING NODES...\00"
@str.11 = [9 x i8] c"RESULTS:\00"
define void @test_free_node() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.9, i64 0, i64 0))
%3 = tail call i32 (...) @populate()
%4 = tail call i32 (...) @print_entries_all()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 @first_element_artist(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @free_node(i32 %6)
%8 = tail call i32 @first_element_artist(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 @free_node(i32 %8)
%10 = tail call i32 @first_element_artist(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%11 = tail call i32 @free_node(i32 %10)
%12 = tail call i32 @first_element_artist(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%13 = tail call i32 @free_node(i32 %12)
%14 = tail call i32 @first_element_artist(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%15 = tail call i32 @free_node(i32 %14)
%16 = tail call i32 @first_element_artist(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%17 = tail call i32 @free_node(i32 %16)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.11, i64 0, i64 0))
%19 = tail call i32 (...) @print_entries_all()
%20 = tail call i32 (...) @free_list()
%21 = tail call i32 (...) @print_entries_all()
ret void
}