#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*/ insertList(struct Node **, int);
int /*<<< orphan*/ printList(struct Node *);
int /*<<< orphan*/ swapNodes(struct Node **, int, int);
int main() {
  struct Node *head = NULL;
  insertList(&head, 9);
  insertList(&head, 8);
  insertList(&head, 6);
  insertList(&head, 4);
  insertList(&head, 1);
  swapNodes(&head, 4, 8);
  printList(head);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x9,%esi
call   1030 <insertList@plt>
lea    -0x10(%rbp),%rdi
mov    $0x8,%esi
call   1030 <insertList@plt>
lea    -0x10(%rbp),%rdi
mov    $0x6,%esi
call   1030 <insertList@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1030 <insertList@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <insertList@plt>
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <swapNodes@plt>
mov    -0x10(%rbp),%rdi
call   1050 <printList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <insertList@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <insertList@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <insertList@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <insertList@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <insertList@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x8,%edx
call   1040 <swapNodes@plt>
mov    0x8(%rsp),%rdi
call   1050 <printList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.Node = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.Node*
store i32 0, i32* %1
store %struct.Node* null, %struct.Node** %2
%3 = call i32 @insertList(%struct.Node** %2, i32 9)
%4 = call i32 @insertList(%struct.Node** %2, i32 8)
%5 = call i32 @insertList(%struct.Node** %2, i32 6)
%6 = call i32 @insertList(%struct.Node** %2, i32 4)
%7 = call i32 @insertList(%struct.Node** %2, i32 1)
%8 = call i32 @swapNodes(%struct.Node** %2, i32 4, i32 8)
%9 = load %struct.Node*, %struct.Node** %2
%10 = call i32 @printList(%struct.Node* %9)
ret i32 0
}

LLVM IR (-O2):
%struct.Node = type { i32 }
define i32 @main() {
%1 = alloca %struct.Node*
%2 = bitcast %struct.Node** %1 to i8*
store %struct.Node* null, %struct.Node** %1
%3 = call i32 @insertList(%struct.Node** %1, i32 9)
%4 = call i32 @insertList(%struct.Node** %1, i32 8)
%5 = call i32 @insertList(%struct.Node** %1, i32 6)
%6 = call i32 @insertList(%struct.Node** %1, i32 4)
%7 = call i32 @insertList(%struct.Node** %1, i32 1)
%8 = call i32 @swapNodes(%struct.Node** %1, i32 4, i32 8)
%9 = load %struct.Node*, %struct.Node** %1
%10 = call i32 @printList(%struct.Node* %9)
ret i32 0
}