#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 isPalindrome(struct ListNode *);
int /*<<< orphan*/ printList(struct ListNode *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int arr[] = {1, 2, 3, 4, 5, 4, 3, 2, 1};
  int arr2[] = {1, 2, 3, 4, 5, 5, 3, 2, 1};
  struct ListNode *head = NULL;
  head = createList(arr, 9);
  printList(head);
  printf("%d\n", isPalindrome(head));
  freeList(head);
  head = createList(arr2, 9);
  printList(head);
  printf("%d\n", isPalindrome(head));
  freeList(head);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe86(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    0xea1(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
movq   $0x0,-0x68(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
call   1060 <createList@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
call   1080 <printList@plt>
mov    -0x68(%rbp),%rdi
call   1070 <isPalindrome@plt>
mov    %eax,%esi
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
mov    -0x68(%rbp),%rdi
call   1030 <freeList@plt>
lea    -0x60(%rbp),%rdi
mov    $0x9,%esi
call   1060 <createList@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
call   1080 <printList@plt>
mov    -0x68(%rbp),%rdi
call   1070 <isPalindrome@plt>
mov    %eax,%esi
lea    0xe4b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x68(%rbp),%rdi
call   1030 <freeList@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    0xec3(%rip),%eax
mov    %eax,0x50(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe8c(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0xed1(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe9a(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x30(%rsp),%rdi
mov    $0x9,%esi
call   1050 <createList@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <printList@plt>
mov    %rbx,%rdi
call   1060 <isPalindrome@plt>
lea    0xe91(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <freeList@plt>
mov    %rsp,%rdi
mov    $0x9,%esi
call   1050 <createList@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <printList@plt>
mov    %rbx,%rdi
call   1060 <isPalindrome@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <freeList@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ListNode = type { i32 }
@__const.main.arr = [9 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 4, i32 3, i32 2, i32 1]
@__const.main.arr2 = [9 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 5, i32 3, i32 2, i32 1]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i32]
%3 = alloca [9 x i32]
%4 = alloca %struct.ListNode*
store i32 0, i32* %1
%5 = bitcast [9 x i32]* %2 to i8*
%6 = bitcast [9 x i32]* %3 to i8*
store %struct.ListNode* null, %struct.ListNode** %4
%7 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%8 = call %struct.ListNode* @createList(i32* %7, i32 9)
store %struct.ListNode* %8, %struct.ListNode** %4
%9 = load %struct.ListNode*, %struct.ListNode** %4
%10 = call i32 @printList(%struct.ListNode* %9)
%11 = load %struct.ListNode*, %struct.ListNode** %4
%12 = call i32 @isPalindrome(%struct.ListNode* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load %struct.ListNode*, %struct.ListNode** %4
%15 = call i32 @freeList(%struct.ListNode* %14)
%16 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 0
%17 = call %struct.ListNode* @createList(i32* %16, i32 9)
store %struct.ListNode* %17, %struct.ListNode** %4
%18 = load %struct.ListNode*, %struct.ListNode** %4
%19 = call i32 @printList(%struct.ListNode* %18)
%20 = load %struct.ListNode*, %struct.ListNode** %4
%21 = call i32 @isPalindrome(%struct.ListNode* %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load %struct.ListNode*, %struct.ListNode** %4
%24 = call i32 @freeList(%struct.ListNode* %23)
ret i32 0
}

LLVM IR (-O2):
%struct.ListNode = type { i32 }
@__const.main.arr = [9 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 4, i32 3, i32 2, i32 1]
@__const.main.arr2 = [9 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 5, i32 3, i32 2, i32 1]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [9 x i32]
%2 = alloca [9 x i32]
%3 = bitcast [9 x i32]* %1 to i8*
%4 = bitcast [9 x i32]* %2 to i8*
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%6 = call %struct.ListNode* @createList(i32* %5, i32 9)
%7 = call i32 @printList(%struct.ListNode* %6)
%8 = call i32 @isPalindrome(%struct.ListNode* %6)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @freeList(%struct.ListNode* %6)
%11 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%12 = call %struct.ListNode* @createList(i32* %11, i32 9)
%13 = call i32 @printList(%struct.ListNode* %12)
%14 = call i32 @isPalindrome(%struct.ListNode* %12)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 @freeList(%struct.ListNode* %12)
ret i32 0
}