#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 maxElementInList(struct node *);
int /*<<< orphan*/ printList(struct node *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stdin;
char *strtok(char *, char *);
int main(int argc, char *argv[]) {
  int value;
  int max;
  struct node *head = NULL;
  struct node *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);
  max = maxElementInList(head);
  printf("%d", max);
  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    0x2e26(%rip),%rax
mov    (%rax),%edx
mov    $0x800,%esi
call   1070 <fgets@plt>
lea    -0x830(%rbp),%rdi
lea    0xe24(%rip),%rsi
call   1090 <strtok@plt>
mov    %rax,-0x838(%rbp)
cmpq   $0x0,-0x838(%rbp)
je     1239 <main+0xb9>
mov    -0x838(%rbp),%rdi
lea    0xe05(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1080 <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    0xde4(%rip),%rsi
call   1090 <strtok@plt>
mov    %rax,-0x838(%rbp)
jmp    11e8 <main+0x68>
mov    -0x20(%rbp),%rdi
call   10a0 <printList@plt>
mov    -0x20(%rbp),%rdi
call   1050 <maxElementInList@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xdb1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1060 <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    0x2e3f(%rip),%rax
mov    (%rax),%edx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x800,%esi
call   1070 <fgets@plt>
lea    0xe3c(%rip),%rsi
mov    %rbx,%rdi
call   1090 <strtok@plt>
test   %rax,%rax
je     1223 <main+0xa3>
lea    0xe31(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0x18(%rsp),%r13
lea    0xe1e(%rip),%rbx
xchg   %ax,%ax
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1080 <sscanf@plt>
mov    0x14(%rsp),%edx
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <insertNode@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1090 <strtok@plt>
test   %rax,%rax
jne    11f0 <main+0x70>
mov    0x8(%rsp),%rdi
jmp    1225 <main+0xa5>
xor    %edi,%edi
call   10a0 <printList@plt>
mov    0x8(%rsp),%rdi
call   1050 <maxElementInList@plt>
lea    0xdce(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    0x8(%rsp),%rdi
call   1060 <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 i32
%8 = alloca %struct.node*
%9 = alloca %struct.node*
%10 = alloca [2048 x i8]
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.node* null, %struct.node** %8
store %struct.node* null, %struct.node** %9
store i8* null, i8** %11
%12 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%13 = load i32, i32* @stdin
%14 = call i32 @fgets(i8* %12, i32 2048, i32 %13)
%15 = getelementptr inbounds [2048 x i8], [2048 x i8]* %10, i64 0, i64 0
%16 = call i8* @strtok(i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i8* %16, i8** %11
br label %17
17: ; preds = %20, %2
%18 = load i8*, i8** %11
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %26
20: ; preds = %17
%21 = load i8*, i8** %11
%22 = call i32 @sscanf(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%23 = load i32, i32* %6
%24 = call i32 @insertNode(%struct.node** %8, %struct.node** %9, i32 %23)
%25 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i8* %25, i8** %11
br label %17
26: ; preds = %17
%27 = load %struct.node*, %struct.node** %8
%28 = call i32 @printList(%struct.node* %27)
%29 = load %struct.node*, %struct.node** %8
%30 = call i32 @maxElementInList(%struct.node* %29)
store i32 %30, i32* %7
%31 = load i32, i32* %7
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = load %struct.node*, %struct.node** %8
%34 = call i32 @destroyList(%struct.node* %33)
store %struct.node* null, %struct.node** %8
store %struct.node* null, %struct.node** %9
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 i32 @maxElementInList(%struct.node* %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = load %struct.node*, %struct.node** %4
%31 = call i32 @destroyList(%struct.node* %30)
ret i32 0
}