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

/* Variables and functions */
int /*<<< orphan*/ printList(struct LinkedListNode *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ push(struct LinkedListNode **, int);
struct LinkedListNode *rem_x(struct LinkedListNode *, int);
int main(void) {
  struct LinkedListNode *head = NULL;
  push(&head, 4);
  push(&head, 11);
  push(&head, 7);
  push(&head, 8);
  push(&head, 5);
  push(&head, 14);
  push(&head, 3);
  push(&head, -2);
  push(&head, 1);
  printf("\nGiven linked list \n");
  printList(head);
  head = rem_x(head, 3);
  printf("\nsort Linked list \n");
  printList(head);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1050 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0xb,%esi
call   1050 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0x7,%esi
call   1050 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0x8,%esi
call   1050 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1050 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0xe,%esi
call   1050 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1050 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0xfffffffe,%esi
call   1050 <push@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1050 <push@plt>
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <printList@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <rem_x@plt>
mov    %rax,-0x10(%rbp)
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1060 <printList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
mov    $0xe,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
mov    $0xfffffffe,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <push@plt>
lea    0xe31(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rdi
call   1060 <printList@plt>
mov    0x8(%rsp),%rdi
mov    $0x3,%esi
call   1040 <rem_x@plt>
mov    %rax,0x8(%rsp)
lea    0xe1b(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rdi
call   1060 <printList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.LinkedListNode = type { i32 }
@.str = [21 x i8] c"\0AGiven linked list \0A\00"
@.str.1 = [20 x i8] c"\0Asort Linked list \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.LinkedListNode*
store i32 0, i32* %1
store %struct.LinkedListNode* null, %struct.LinkedListNode** %2
%3 = call i32 @push(%struct.LinkedListNode** %2, i32 4)
%4 = call i32 @push(%struct.LinkedListNode** %2, i32 11)
%5 = call i32 @push(%struct.LinkedListNode** %2, i32 7)
%6 = call i32 @push(%struct.LinkedListNode** %2, i32 8)
%7 = call i32 @push(%struct.LinkedListNode** %2, i32 5)
%8 = call i32 @push(%struct.LinkedListNode** %2, i32 14)
%9 = call i32 @push(%struct.LinkedListNode** %2, i32 3)
%10 = call i32 @push(%struct.LinkedListNode** %2, i32 -2)
%11 = call i32 @push(%struct.LinkedListNode** %2, i32 1)
%12 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%13 = load %struct.LinkedListNode*, %struct.LinkedListNode** %2
%14 = call i32 @printList(%struct.LinkedListNode* %13)
%15 = load %struct.LinkedListNode*, %struct.LinkedListNode** %2
%16 = call %struct.LinkedListNode* @rem_x(%struct.LinkedListNode* %15, i32 3)
store %struct.LinkedListNode* %16, %struct.LinkedListNode** %2
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%18 = load %struct.LinkedListNode*, %struct.LinkedListNode** %2
%19 = call i32 @printList(%struct.LinkedListNode* %18)
ret i32 0
}

LLVM IR (-O2):
%struct.LinkedListNode = type { i32 }
@str = [20 x i8] c"\0AGiven linked list \00"
@str.2 = [19 x i8] c"\0Asort Linked list \00"
define i32 @main() {
%1 = alloca %struct.LinkedListNode*
%2 = bitcast %struct.LinkedListNode** %1 to i8*
store %struct.LinkedListNode* null, %struct.LinkedListNode** %1
%3 = call i32 @push(%struct.LinkedListNode** %1, i32 4)
%4 = call i32 @push(%struct.LinkedListNode** %1, i32 11)
%5 = call i32 @push(%struct.LinkedListNode** %1, i32 7)
%6 = call i32 @push(%struct.LinkedListNode** %1, i32 8)
%7 = call i32 @push(%struct.LinkedListNode** %1, i32 5)
%8 = call i32 @push(%struct.LinkedListNode** %1, i32 14)
%9 = call i32 @push(%struct.LinkedListNode** %1, i32 3)
%10 = call i32 @push(%struct.LinkedListNode** %1, i32 -2)
%11 = call i32 @push(%struct.LinkedListNode** %1, i32 1)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%13 = load %struct.LinkedListNode*, %struct.LinkedListNode** %1
%14 = call i32 @printList(%struct.LinkedListNode* %13)
%15 = load %struct.LinkedListNode*, %struct.LinkedListNode** %1
%16 = call %struct.LinkedListNode* @rem_x(%struct.LinkedListNode* %15, i32 3)
store %struct.LinkedListNode* %16, %struct.LinkedListNode** %1
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.2, i64 0, i64 0))
%18 = load %struct.LinkedListNode*, %struct.LinkedListNode** %1
%19 = call i32 @printList(%struct.LinkedListNode* %18)
ret i32 0
}