#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 */
struct node *create(int);
int /*<<< orphan*/ printList();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ swapNodes(struct node *, struct node *);
int main() {
  struct node *a, *b, *c, *d, *e;
  a = create(15);
  b = create(12);
  c = create(1);
  d = create(0);
  e = create(50);
  printf("\n Linked list before calling swapNodes() ");
  printList();
  swapNodes(d, c);
  printf("\n Linked list after calling swapNodes() ");
  printList();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xf,%edi
call   1040 <create@plt>
mov    %rax,-0x10(%rbp)
mov    $0xc,%edi
call   1040 <create@plt>
mov    %rax,-0x18(%rbp)
mov    $0x1,%edi
call   1040 <create@plt>
mov    %rax,-0x20(%rbp)
xor    %edi,%edi
call   1040 <create@plt>
mov    %rax,-0x28(%rbp)
mov    $0x32,%edi
call   1040 <create@plt>
mov    %rax,-0x30(%rbp)
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <printList@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <swapNodes@plt>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <printList@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xf,%edi
call   1040 <create@plt>
mov    $0xc,%edi
call   1040 <create@plt>
mov    $0x1,%edi
call   1040 <create@plt>
mov    %rax,%r14
xor    %edi,%edi
call   1040 <create@plt>
mov    %rax,%rbx
mov    $0x32,%edi
call   1040 <create@plt>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <swapNodes@plt>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <printList@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [42 x i8] c"\0A Linked list before calling swapNodes() \00"
@.str.1 = [41 x i8] c"\0A Linked list after calling swapNodes() \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
%3 = alloca %struct.node*
%4 = alloca %struct.node*
%5 = alloca %struct.node*
%6 = alloca %struct.node*
store i32 0, i32* %1
%7 = call %struct.node* @create(i32 15)
store %struct.node* %7, %struct.node** %2
%8 = call %struct.node* @create(i32 12)
store %struct.node* %8, %struct.node** %3
%9 = call %struct.node* @create(i32 1)
store %struct.node* %9, %struct.node** %4
%10 = call %struct.node* @create(i32 0)
store %struct.node* %10, %struct.node** %5
%11 = call %struct.node* @create(i32 50)
store %struct.node* %11, %struct.node** %6
%12 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (...) @printList()
%14 = load %struct.node*, %struct.node** %5
%15 = load %struct.node*, %struct.node** %4
%16 = call i32 @swapNodes(%struct.node* %14, %struct.node* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 (...) @printList()
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [42 x i8] c"\0A Linked list before calling swapNodes() \00"
@.str.1 = [41 x i8] c"\0A Linked list after calling swapNodes() \00"
define i32 @main() {
%1 = tail call %struct.node* @create(i32 15)
%2 = tail call %struct.node* @create(i32 12)
%3 = tail call %struct.node* @create(i32 1)
%4 = tail call %struct.node* @create(i32 0)
%5 = tail call %struct.node* @create(i32 50)
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @printList()
%8 = tail call i32 @swapNodes(%struct.node* %4, %struct.node* %3)
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 (...) @printList()
ret i32 0
}