#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*/ addNewNodeFront(struct node **, int);
int /*<<< orphan*/ printf(char *, char *);
struct node *reverseByCount(struct node *, int);
int /*<<< orphan*/ traverseLinkedList(struct node *);
int main() {
  struct node **head;
  *head = NULL;
  addNewNodeFront(head, 1);
  addNewNodeFront(head, 2);
  addNewNodeFront(head, 3);
  addNewNodeFront(head, 4);
  addNewNodeFront(head, 5);
  traverseLinkedList(*head);
  printf("\n%s\n\n", "After reverse operation.");
  traverseLinkedList(reverseByCount(*head, 3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1050 <addNewNodeFront@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1050 <addNewNodeFront@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1050 <addNewNodeFront@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1050 <addNewNodeFront@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1050 <addNewNodeFront@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <traverseLinkedList@plt>
lea    0xe4d(%rip),%rdi
lea    0xe4c(%rip),%rsi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x3,%esi
call   1030 <reverseByCount@plt>
mov    %rax,%rdi
call   1060 <traverseLinkedList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [6 x i8] c"\0A%s\0A\0A\00"
@.str.1 = [25 x i8] c"After reverse operation.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node**
store i32 0, i32* %1
%3 = load %struct.node**, %struct.node*** %2
store %struct.node* null, %struct.node** %3
%4 = load %struct.node**, %struct.node*** %2
%5 = call i32 @addNewNodeFront(%struct.node** %4, i32 1)
%6 = load %struct.node**, %struct.node*** %2
%7 = call i32 @addNewNodeFront(%struct.node** %6, i32 2)
%8 = load %struct.node**, %struct.node*** %2
%9 = call i32 @addNewNodeFront(%struct.node** %8, i32 3)
%10 = load %struct.node**, %struct.node*** %2
%11 = call i32 @addNewNodeFront(%struct.node** %10, i32 4)
%12 = load %struct.node**, %struct.node*** %2
%13 = call i32 @addNewNodeFront(%struct.node** %12, i32 5)
%14 = load %struct.node**, %struct.node*** %2
%15 = load %struct.node*, %struct.node** %14
%16 = call i32 @traverseLinkedList(%struct.node* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%18 = load %struct.node**, %struct.node*** %2
%19 = load %struct.node*, %struct.node** %18
%20 = call %struct.node* @reverseByCount(%struct.node* %19, i32 3)
%21 = call i32 @traverseLinkedList(%struct.node* %20)
ret i32 0
}

LLVM IR (-O2):