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

/* Variables and functions */
struct ListNode *createList(int *, int);
int /*<<< orphan*/ freeList(struct ListNode *);
int /*<<< orphan*/ printList(struct ListNode *);
struct ListNode *rotateRight(struct ListNode *, int);
int main(void) {
  int arr[] = {1, 2, 3, 4, 5};
  struct ListNode *head = createList(arr, 5);
  printList(head);
  head = rotateRight(head, 2);
  printList(head);
  freeList(head);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xea5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <createList@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <printList@plt>
mov    -0x28(%rbp),%rdi
mov    $0x2,%esi
call   1050 <rotateRight@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <printList@plt>
mov    -0x28(%rbp),%rdi
call   1030 <freeList@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xec5(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <createList@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <rotateRight@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
call   1030 <freeList@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.ListNode = type { i32 }
@__const.main.arr = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca %struct.ListNode*
store i32 0, i32* %1
%4 = bitcast [5 x i32]* %2 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%6 = call %struct.ListNode* @createList(i32* %5, i32 5)
store %struct.ListNode* %6, %struct.ListNode** %3
%7 = load %struct.ListNode*, %struct.ListNode** %3
%8 = call i32 @printList(%struct.ListNode* %7)
%9 = load %struct.ListNode*, %struct.ListNode** %3
%10 = call %struct.ListNode* @rotateRight(%struct.ListNode* %9, i32 2)
store %struct.ListNode* %10, %struct.ListNode** %3
%11 = load %struct.ListNode*, %struct.ListNode** %3
%12 = call i32 @printList(%struct.ListNode* %11)
%13 = load %struct.ListNode*, %struct.ListNode** %3
%14 = call i32 @freeList(%struct.ListNode* %13)
ret i32 0
}

LLVM IR (-O2):
%struct.ListNode = type { i32 }
@__const.main.arr = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call %struct.ListNode* @createList(i32* %3, i32 5)
%5 = call i32 @printList(%struct.ListNode* %4)
%6 = call %struct.ListNode* @rotateRight(%struct.ListNode* %4, i32 2)
%7 = call i32 @printList(%struct.ListNode* %6)
%8 = call i32 @freeList(%struct.ListNode* %6)
ret i32 0
}