#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*/ destroyList(struct node *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ insertNode(struct node **, struct node **, int);
int /*<<< orphan*/ printList(struct node *);
struct node *seggregateEvenAndOddData(struct node *);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stdin;
char *strtok(char *, char *);
int main(int argc, char *argv[]) {
  int value;
  struct node *head = NULL, *tail = NULL;
  char buffer[2048];
  char *p = NULL;
  fgets(buffer, 2048, stdin);
  p = strtok(buffer, "NULL >|\n");
  while (p != NULL) {
    sscanf(p, "%d", &value);
    insertNode(&head, &tail, value);
    p = strtok(NULL, "> | NULL \n");
  }
  printList(head);
  head = seggregateEvenAndOddData(head);
  printList(head);
  destroyList(head);
  head = NULL;
  tail = NULL;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x838(%rbp)
lea    -0x830(%rbp),%rdi
mov    0x2e36(%rip),%rax
mov    (%rax),%edx
mov    $0x800,%esi
call   1050 <fgets@plt>
lea    -0x830(%rbp),%rdi
lea    0xe34(%rip),%rsi
call   1080 <strtok@plt>
mov    %rax,-0x838(%rbp)
cmpq   $0x0,-0x838(%rbp)
je     1229 <main+0xb9>
mov    -0x838(%rbp),%rdi
lea    0xe15(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1070 <sscanf@plt>
mov    -0x14(%rbp),%edx
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <insertNode@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xdf4(%rip),%rsi
call   1080 <strtok@plt>
mov    %rax,-0x838(%rbp)
jmp    11d8 <main+0x68>
mov    -0x20(%rbp),%rdi
call   1090 <printList@plt>
mov    -0x20(%rbp),%rdi
call   1060 <seggregateEvenAndOddData@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1090 <printList@plt>
mov    -0x20(%rbp),%rdi
call   1040 <destroyList@plt>
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
xor    %eax,%eax
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x820,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x18(%rsp)
mov    0x2e4f(%rip),%rax
mov    (%rax),%edx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x800,%esi
call   1050 <fgets@plt>
lea    0xe4c(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strtok@plt>
test   %rax,%rax
je     1213 <main+0xa3>
lea    0xe41(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0x18(%rsp),%r13
lea    0xe2e(%rip),%rbx
xchg   %ax,%ax
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1070 <sscanf@plt>
mov    0x14(%rsp),%edx
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <insertNode@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1080 <strtok@plt>
test   %rax,%rax
jne    11e0 <main+0x70>
mov    0x8(%rsp),%rdi
jmp    1215 <main+0xa5>
xor    %edi,%edi
call   1090 <printList@plt>
mov    0x8(%rsp),%rdi
call   1060 <seggregateEvenAndOddData@plt>
mov    %rax,0x8(%rsp)
mov    %rax,%rdi
call   1090 <printList@plt>
mov    0x8(%rsp),%rdi
call   1040 <destroyList@plt>
xor    %eax,%eax
add    $0x820,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@stdin = global i32 0
@.str = [9 x i8] c"NULL >|\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"> | NULL \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.node*
%8 = alloca %struct.node*
%9 = alloca [2048 x i8]
%10 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.node* null, %struct.node** %7
store %struct.node* null, %struct.node** %8
store i8* null, i8** %10
%11 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %11, i32 2048, i32 %12)
%14 = getelementptr inbounds [2048 x i8], [2048 x i8]* %9, i64 0, i64 0
%15 = call i8* @strtok(i8* %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i8* %15, i8** %10
br label %16
16: ; preds = %19, %2
%17 = load i8*, i8** %10
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i8*, i8** %10
%21 = call i32 @sscanf(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%22 = load i32, i32* %6
%23 = call i32 @insertNode(%struct.node** %7, %struct.node** %8, i32 %22)
%24 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i8* %24, i8** %10
br label %16
25: ; preds = %16
%26 = load %struct.node*, %struct.node** %7
%27 = call i32 @printList(%struct.node* %26)
%28 = load %struct.node*, %struct.node** %7
%29 = call %struct.node* @seggregateEvenAndOddData(%struct.node* %28)
store %struct.node* %29, %struct.node** %7
%30 = load %struct.node*, %struct.node** %7
%31 = call i32 @printList(%struct.node* %30)
%32 = load %struct.node*, %struct.node** %7
%33 = call i32 @destroyList(%struct.node* %32)
store %struct.node* null, %struct.node** %7
store %struct.node* null, %struct.node** %8
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@stdin = global i32 0
@.str = [9 x i8] c"NULL >|\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"> | NULL \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca %struct.node*
%5 = alloca %struct.node*
%6 = alloca [2048 x i8]
%7 = bitcast i32* %3 to i8*
%8 = bitcast %struct.node** %4 to i8*
store %struct.node* null, %struct.node** %4
%9 = bitcast %struct.node** %5 to i8*
store %struct.node* null, %struct.node** %5
%10 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %10, i32 2048, i32 %11)
%13 = call i8* @strtok(i8* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i8* %13, null
br i1 %14, label %24, label %15
15: ; preds = %2, %15
%16 = phi i8* [ %20, %15 ], [ %13, %2 ]
%17 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%18 = load i32, i32* %3
%19 = call i32 @insertNode(%struct.node** %4, %struct.node** %5, i32 %18)
%20 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %15
22: ; preds = %15
%23 = load %struct.node*, %struct.node** %4
br label %24
24: ; preds = %22, %2
%25 = phi %struct.node* [ %23, %22 ], [ null, %2 ]
%26 = call i32 @printList(%struct.node* %25)
%27 = load %struct.node*, %struct.node** %4
%28 = call %struct.node* @seggregateEvenAndOddData(%struct.node* %27)
store %struct.node* %28, %struct.node** %4
%29 = call i32 @printList(%struct.node* %28)
%30 = load %struct.node*, %struct.node** %4
%31 = call i32 @destroyList(%struct.node* %30)
ret i32 0
}