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

/* Variables and functions */
struct sll_node *sll_add_at_head(struct sll_node *, int);
struct sll_node *sll_add_at_index(struct sll_node *, int, int);
struct sll_node *sll_add_at_tail(struct sll_node *, int);
struct sll_node *sll_delete_at_index(struct sll_node *, int);
int /*<<< orphan*/ sll_destroy(struct sll_node *);
int /*<<< orphan*/ sll_print(struct sll_node *);
void main() {
  struct sll_node *h = NULL;
  h = sll_add_at_head(h, 2);
  h = sll_add_at_head(h, 3);
  h = sll_add_at_head(h, 4);
  h = sll_add_at_head(h, 5);
  sll_print(h);
  h = sll_add_at_index(h, 9, 0);
  h = sll_add_at_index(h, 6, 2);
  h = sll_add_at_index(h, 7, 4);
  h = sll_add_at_index(h, 8, 8);
  sll_print(h);
  h = sll_add_at_tail(h, 10);
  h = sll_add_at_tail(h, 11);
  h = sll_add_at_tail(h, 12);
  sll_print(h);
  h = sll_delete_at_index(h, 11);
  sll_print(h);
  h = sll_delete_at_index(h, 10);
  sll_print(h);
  h = sll_delete_at_index(h, 0);
  sll_print(h);
  h = sll_delete_at_index(h, 2);
  sll_print(h);
  h = sll_delete_at_index(h, 4);
  sll_print(h);
  h = sll_delete_at_index(h, 6);
  sll_print(h);
  sll_destroy(h);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1060 <sll_add_at_head@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1060 <sll_add_at_head@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1060 <sll_add_at_head@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x5,%esi
call   1060 <sll_add_at_head@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sll_print@plt>
mov    -0x8(%rbp),%rdi
mov    $0x9,%esi
xor    %edx,%edx
call   1070 <sll_add_at_index@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
mov    $0x2,%edx
call   1070 <sll_add_at_index@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x7,%esi
mov    $0x4,%edx
call   1070 <sll_add_at_index@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%edx
mov    %edx,%esi
call   1070 <sll_add_at_index@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sll_print@plt>
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1080 <sll_add_at_tail@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xb,%esi
call   1080 <sll_add_at_tail@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xc,%esi
call   1080 <sll_add_at_tail@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sll_print@plt>
mov    -0x8(%rbp),%rdi
mov    $0xb,%esi
call   1030 <sll_delete_at_index@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sll_print@plt>
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <sll_delete_at_index@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sll_print@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <sll_delete_at_index@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sll_print@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1030 <sll_delete_at_index@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sll_print@plt>
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1030 <sll_delete_at_index@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sll_print@plt>
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
call   1030 <sll_delete_at_index@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sll_print@plt>
mov    -0x8(%rbp),%rdi
call   1050 <sll_destroy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
mov    $0x2,%esi
call   1060 <sll_add_at_head@plt>
mov    %rax,%rdi
mov    $0x3,%esi
call   1060 <sll_add_at_head@plt>
mov    %rax,%rdi
mov    $0x4,%esi
call   1060 <sll_add_at_head@plt>
mov    %rax,%rdi
mov    $0x5,%esi
call   1060 <sll_add_at_head@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sll_print@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %edx,%edx
call   1070 <sll_add_at_index@plt>
mov    %rax,%rdi
mov    $0x6,%esi
mov    $0x2,%edx
call   1070 <sll_add_at_index@plt>
mov    %rax,%rdi
mov    $0x7,%esi
mov    $0x4,%edx
call   1070 <sll_add_at_index@plt>
mov    %rax,%rdi
mov    $0x8,%esi
mov    $0x8,%edx
call   1070 <sll_add_at_index@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sll_print@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1080 <sll_add_at_tail@plt>
mov    %rax,%rdi
mov    $0xb,%esi
call   1080 <sll_add_at_tail@plt>
mov    %rax,%rdi
mov    $0xc,%esi
call   1080 <sll_add_at_tail@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sll_print@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1030 <sll_delete_at_index@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sll_print@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <sll_delete_at_index@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sll_print@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <sll_delete_at_index@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sll_print@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <sll_delete_at_index@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sll_print@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <sll_delete_at_index@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sll_print@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <sll_delete_at_index@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sll_print@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <sll_destroy@plt>

LLVM IR (-O0):
%struct.sll_node = type { i32 }
define void @main() {
%1 = alloca %struct.sll_node*
store %struct.sll_node* null, %struct.sll_node** %1
%2 = load %struct.sll_node*, %struct.sll_node** %1
%3 = call %struct.sll_node* @sll_add_at_head(%struct.sll_node* %2, i32 2)
store %struct.sll_node* %3, %struct.sll_node** %1
%4 = load %struct.sll_node*, %struct.sll_node** %1
%5 = call %struct.sll_node* @sll_add_at_head(%struct.sll_node* %4, i32 3)
store %struct.sll_node* %5, %struct.sll_node** %1
%6 = load %struct.sll_node*, %struct.sll_node** %1
%7 = call %struct.sll_node* @sll_add_at_head(%struct.sll_node* %6, i32 4)
store %struct.sll_node* %7, %struct.sll_node** %1
%8 = load %struct.sll_node*, %struct.sll_node** %1
%9 = call %struct.sll_node* @sll_add_at_head(%struct.sll_node* %8, i32 5)
store %struct.sll_node* %9, %struct.sll_node** %1
%10 = load %struct.sll_node*, %struct.sll_node** %1
%11 = call i32 @sll_print(%struct.sll_node* %10)
%12 = load %struct.sll_node*, %struct.sll_node** %1
%13 = call %struct.sll_node* @sll_add_at_index(%struct.sll_node* %12, i32 9, i32 0)
store %struct.sll_node* %13, %struct.sll_node** %1
%14 = load %struct.sll_node*, %struct.sll_node** %1
%15 = call %struct.sll_node* @sll_add_at_index(%struct.sll_node* %14, i32 6, i32 2)
store %struct.sll_node* %15, %struct.sll_node** %1
%16 = load %struct.sll_node*, %struct.sll_node** %1
%17 = call %struct.sll_node* @sll_add_at_index(%struct.sll_node* %16, i32 7, i32 4)
store %struct.sll_node* %17, %struct.sll_node** %1
%18 = load %struct.sll_node*, %struct.sll_node** %1
%19 = call %struct.sll_node* @sll_add_at_index(%struct.sll_node* %18, i32 8, i32 8)
store %struct.sll_node* %19, %struct.sll_node** %1
%20 = load %struct.sll_node*, %struct.sll_node** %1
%21 = call i32 @sll_print(%struct.sll_node* %20)
%22 = load %struct.sll_node*, %struct.sll_node** %1
%23 = call %struct.sll_node* @sll_add_at_tail(%struct.sll_node* %22, i32 10)
store %struct.sll_node* %23, %struct.sll_node** %1
%24 = load %struct.sll_node*, %struct.sll_node** %1
%25 = call %struct.sll_node* @sll_add_at_tail(%struct.sll_node* %24, i32 11)
store %struct.sll_node* %25, %struct.sll_node** %1
%26 = load %struct.sll_node*, %struct.sll_node** %1
%27 = call %struct.sll_node* @sll_add_at_tail(%struct.sll_node* %26, i32 12)
store %struct.sll_node* %27, %struct.sll_node** %1
%28 = load %struct.sll_node*, %struct.sll_node** %1
%29 = call i32 @sll_print(%struct.sll_node* %28)
%30 = load %struct.sll_node*, %struct.sll_node** %1
%31 = call %struct.sll_node* @sll_delete_at_index(%struct.sll_node* %30, i32 11)
store %struct.sll_node* %31, %struct.sll_node** %1
%32 = load %struct.sll_node*, %struct.sll_node** %1
%33 = call i32 @sll_print(%struct.sll_node* %32)
%34 = load %struct.sll_node*, %struct.sll_node** %1
%35 = call %struct.sll_node* @sll_delete_at_index(%struct.sll_node* %34, i32 10)
store %struct.sll_node* %35, %struct.sll_node** %1
%36 = load %struct.sll_node*, %struct.sll_node** %1
%37 = call i32 @sll_print(%struct.sll_node* %36)
%38 = load %struct.sll_node*, %struct.sll_node** %1
%39 = call %struct.sll_node* @sll_delete_at_index(%struct.sll_node* %38, i32 0)
store %struct.sll_node* %39, %struct.sll_node** %1
%40 = load %struct.sll_node*, %struct.sll_node** %1
%41 = call i32 @sll_print(%struct.sll_node* %40)
%42 = load %struct.sll_node*, %struct.sll_node** %1
%43 = call %struct.sll_node* @sll_delete_at_index(%struct.sll_node* %42, i32 2)
store %struct.sll_node* %43, %struct.sll_node** %1
%44 = load %struct.sll_node*, %struct.sll_node** %1
%45 = call i32 @sll_print(%struct.sll_node* %44)
%46 = load %struct.sll_node*, %struct.sll_node** %1
%47 = call %struct.sll_node* @sll_delete_at_index(%struct.sll_node* %46, i32 4)
store %struct.sll_node* %47, %struct.sll_node** %1
%48 = load %struct.sll_node*, %struct.sll_node** %1
%49 = call i32 @sll_print(%struct.sll_node* %48)
%50 = load %struct.sll_node*, %struct.sll_node** %1
%51 = call %struct.sll_node* @sll_delete_at_index(%struct.sll_node* %50, i32 6)
store %struct.sll_node* %51, %struct.sll_node** %1
%52 = load %struct.sll_node*, %struct.sll_node** %1
%53 = call i32 @sll_print(%struct.sll_node* %52)
%54 = load %struct.sll_node*, %struct.sll_node** %1
%55 = call i32 @sll_destroy(%struct.sll_node* %54)
ret void
}

LLVM IR (-O2):
%struct.sll_node = type { i32 }
define void @main() {
%1 = tail call %struct.sll_node* @sll_add_at_head(%struct.sll_node* null, i32 2)
%2 = tail call %struct.sll_node* @sll_add_at_head(%struct.sll_node* %1, i32 3)
%3 = tail call %struct.sll_node* @sll_add_at_head(%struct.sll_node* %2, i32 4)
%4 = tail call %struct.sll_node* @sll_add_at_head(%struct.sll_node* %3, i32 5)
%5 = tail call i32 @sll_print(%struct.sll_node* %4)
%6 = tail call %struct.sll_node* @sll_add_at_index(%struct.sll_node* %4, i32 9, i32 0)
%7 = tail call %struct.sll_node* @sll_add_at_index(%struct.sll_node* %6, i32 6, i32 2)
%8 = tail call %struct.sll_node* @sll_add_at_index(%struct.sll_node* %7, i32 7, i32 4)
%9 = tail call %struct.sll_node* @sll_add_at_index(%struct.sll_node* %8, i32 8, i32 8)
%10 = tail call i32 @sll_print(%struct.sll_node* %9)
%11 = tail call %struct.sll_node* @sll_add_at_tail(%struct.sll_node* %9, i32 10)
%12 = tail call %struct.sll_node* @sll_add_at_tail(%struct.sll_node* %11, i32 11)
%13 = tail call %struct.sll_node* @sll_add_at_tail(%struct.sll_node* %12, i32 12)
%14 = tail call i32 @sll_print(%struct.sll_node* %13)
%15 = tail call %struct.sll_node* @sll_delete_at_index(%struct.sll_node* %13, i32 11)
%16 = tail call i32 @sll_print(%struct.sll_node* %15)
%17 = tail call %struct.sll_node* @sll_delete_at_index(%struct.sll_node* %15, i32 10)
%18 = tail call i32 @sll_print(%struct.sll_node* %17)
%19 = tail call %struct.sll_node* @sll_delete_at_index(%struct.sll_node* %17, i32 0)
%20 = tail call i32 @sll_print(%struct.sll_node* %19)
%21 = tail call %struct.sll_node* @sll_delete_at_index(%struct.sll_node* %19, i32 2)
%22 = tail call i32 @sll_print(%struct.sll_node* %21)
%23 = tail call %struct.sll_node* @sll_delete_at_index(%struct.sll_node* %21, i32 4)
%24 = tail call i32 @sll_print(%struct.sll_node* %23)
%25 = tail call %struct.sll_node* @sll_delete_at_index(%struct.sll_node* %23, i32 6)
%26 = tail call i32 @sll_print(%struct.sll_node* %25)
%27 = tail call i32 @sll_destroy(%struct.sll_node* %25)
ret void
}