#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 *removeElements(struct ListNode *, int);
int main(void) {
  int arr[] = {1, 2, 6, 3, 4, 5, 6};
  int arr2[] = {1, 1};
  struct ListNode *head = NULL;
  head = createList(arr, 7);
  printList(head);
  head = removeElements(head, 6);
  printList(head);
  freeList(head);
  head = createList(arr2, 2);
  printList(head);
  head = removeElements(head, 1);
  printList(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    0xea4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xea2(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xe9c(%rip),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1050 <createList@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <printList@plt>
mov    -0x30(%rbp),%rdi
mov    $0x6,%esi
call   1040 <removeElements@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <printList@plt>
mov    -0x30(%rbp),%rdi
call   1030 <freeList@plt>
lea    -0x28(%rbp),%rdi
mov    $0x2,%esi
call   1050 <createList@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <printList@plt>
mov    -0x30(%rbp),%rdi
mov    $0x1,%esi
call   1040 <removeElements@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <printList@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movups 0xec0(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x100000001,%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x7,%esi
call   1050 <createList@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <removeElements@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
call   1030 <freeList@plt>
lea    0x8(%rsp),%rdi
mov    $0x2,%esi
call   1050 <createList@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <removeElements@plt>
mov    %rax,%rdi
call   1060 <printList@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.ListNode = type { i32 }
@__const.main.arr = [7 x i32] [i32 1, i32 2, i32 6, i32 3, i32 4, i32 5, i32 6]
@__const.main.arr2 = [2 x i32] [i32 1, i32 1]
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
%3 = alloca [2 x i32]
%4 = alloca %struct.ListNode*
store i32 0, i32* %1
%5 = bitcast [7 x i32]* %2 to i8*
%6 = bitcast [2 x i32]* %3 to i8*
store %struct.ListNode* null, %struct.ListNode** %4
%7 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%8 = call %struct.ListNode* @createList(i32* %7, i32 7)
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 %struct.ListNode* @removeElements(%struct.ListNode* %11, i32 6)
store %struct.ListNode* %12, %struct.ListNode** %4
%13 = load %struct.ListNode*, %struct.ListNode** %4
%14 = call i32 @printList(%struct.ListNode* %13)
%15 = load %struct.ListNode*, %struct.ListNode** %4
%16 = call i32 @freeList(%struct.ListNode* %15)
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%18 = call %struct.ListNode* @createList(i32* %17, i32 2)
store %struct.ListNode* %18, %struct.ListNode** %4
%19 = load %struct.ListNode*, %struct.ListNode** %4
%20 = call i32 @printList(%struct.ListNode* %19)
%21 = load %struct.ListNode*, %struct.ListNode** %4
%22 = call %struct.ListNode* @removeElements(%struct.ListNode* %21, i32 1)
store %struct.ListNode* %22, %struct.ListNode** %4
%23 = load %struct.ListNode*, %struct.ListNode** %4
%24 = call i32 @printList(%struct.ListNode* %23)
ret i32 0
}

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