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

/* Variables and functions */
int /*<<< orphan*/ addNewNode(struct node *, int);
int /*<<< orphan*/ deleteList(struct node *);
struct node *initNode(int /*<<< orphan*/);
int /*<<< orphan*/ printList(struct node *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ removeKthMethodOne(struct node *, int);
int /*<<< orphan*/ removeKthMethodTwo(struct node *, int);
int main() {
  struct node *ptr = initNode(0);
  for (int i = 1; i < 10; i++) {
    addNewNode(ptr, i);
  }
  printf("List: ");
  printList(ptr);
  printf("Remove 1th element: ");
  removeKthMethodOne(ptr, 1);
  printList(ptr);
  printf("Remove 3rd element: ");
  removeKthMethodTwo(ptr, 3);
  printList(ptr);
  deleteList(ptr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <initNode@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11b5 <main+0x45>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <addNewNode@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1191 <main+0x21>
lea    0xe44(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <printList@plt>
lea    0xe36(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1060 <removeKthMethodOne@plt>
mov    -0x10(%rbp),%rdi
call   1090 <printList@plt>
lea    0xe28(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1080 <removeKthMethodTwo@plt>
mov    -0x10(%rbp),%rdi
call   1090 <printList@plt>
mov    -0x10(%rbp),%rdi
call   1070 <deleteList@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1030 <initNode@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x1,%esi
call   1040 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <addNewNode@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <addNewNode@plt>
lea    0xe09(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1090 <printList@plt>
lea    0xdfc(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1060 <removeKthMethodOne@plt>
mov    %rbx,%rdi
call   1090 <printList@plt>
lea    0xdf0(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1080 <removeKthMethodTwo@plt>
mov    %rbx,%rdi
call   1090 <printList@plt>
mov    %rbx,%rdi
call   1070 <deleteList@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [7 x i8] c"List: \00"
@.str.1 = [21 x i8] c"Remove 1th element: \00"
@.str.2 = [21 x i8] c"Remove 3rd element: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
%3 = alloca i32
store i32 0, i32* %1
%4 = call %struct.node* @initNode(i32 0)
store %struct.node* %4, %struct.node** %2
store i32 1, i32* %3
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load %struct.node*, %struct.node** %2
%10 = load i32, i32* %3
%11 = call i32 @addNewNode(%struct.node* %9, i32 %10)
br label %12
12: ; preds = %8
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %5
15: ; preds = %5
%16 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = load %struct.node*, %struct.node** %2
%18 = call i32 @printList(%struct.node* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%20 = load %struct.node*, %struct.node** %2
%21 = call i32 @removeKthMethodOne(%struct.node* %20, i32 1)
%22 = load %struct.node*, %struct.node** %2
%23 = call i32 @printList(%struct.node* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%25 = load %struct.node*, %struct.node** %2
%26 = call i32 @removeKthMethodTwo(%struct.node* %25, i32 3)
%27 = load %struct.node*, %struct.node** %2
%28 = call i32 @printList(%struct.node* %27)
%29 = load %struct.node*, %struct.node** %2
%30 = call i32 @deleteList(%struct.node* %29)
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [7 x i8] c"List: \00"
@.str.1 = [21 x i8] c"Remove 1th element: \00"
@.str.2 = [21 x i8] c"Remove 3rd element: \00"
define i32 @main() {
%1 = tail call %struct.node* @initNode(i32 0)
%2 = tail call i32 @addNewNode(%struct.node* %1, i32 1)
%3 = tail call i32 @addNewNode(%struct.node* %1, i32 2)
%4 = tail call i32 @addNewNode(%struct.node* %1, i32 3)
%5 = tail call i32 @addNewNode(%struct.node* %1, i32 4)
%6 = tail call i32 @addNewNode(%struct.node* %1, i32 5)
%7 = tail call i32 @addNewNode(%struct.node* %1, i32 6)
%8 = tail call i32 @addNewNode(%struct.node* %1, i32 7)
%9 = tail call i32 @addNewNode(%struct.node* %1, i32 8)
%10 = tail call i32 @addNewNode(%struct.node* %1, i32 9)
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 @printList(%struct.node* %1)
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%14 = tail call i32 @removeKthMethodOne(%struct.node* %1, i32 1)
%15 = tail call i32 @printList(%struct.node* %1)
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 @removeKthMethodTwo(%struct.node* %1, i32 3)
%18 = tail call i32 @printList(%struct.node* %1)
%19 = tail call i32 @deleteList(%struct.node* %1)
ret i32 0
}