#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 */
int /*<<< orphan*/ mk_list(struct ListNode **, int *, int);
int /*<<< orphan*/ print(struct ListNode *);
struct ListNode *removeElements(struct ListNode *, int);
int main(int argc, char **argv) {
  struct ListNode *head;
  int a[] = {1, 2, 2, 1};
  mk_list(&head, a, 4);
  print(head);
  head = removeElements(head, 2);
  print(head);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x30(%rbp),%rsi
lea    -0x18(%rbp),%rdi
mov    $0x4,%edx
call   1050 <mk_list@plt>
mov    -0x18(%rbp),%rdi
call   1040 <print@plt>
mov    -0x18(%rbp),%rdi
mov    $0x2,%esi
call   1030 <removeElements@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xec5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    $0x4,%edx
call   1050 <mk_list@plt>
mov    0x8(%rsp),%rdi
call   1040 <print@plt>
mov    0x8(%rsp),%rdi
mov    $0x2,%esi
call   1030 <removeElements@plt>
mov    %rax,0x8(%rsp)
mov    %rax,%rdi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
%struct.ListNode = type { i32 }
@__const.main.a = [4 x i32] [i32 1, i32 2, i32 2, i32 1]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.ListNode*
%4 = alloca [4 x i32]
%5 = bitcast %struct.ListNode** %3 to i8*
%6 = bitcast [4 x i32]* %4 to i8*
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%8 = call i32 @mk_list(%struct.ListNode** %3, i32* %7, i32 4)
%9 = load %struct.ListNode*, %struct.ListNode** %3
%10 = call i32 @print(%struct.ListNode* %9)
%11 = load %struct.ListNode*, %struct.ListNode** %3
%12 = call %struct.ListNode* @removeElements(%struct.ListNode* %11, i32 2)
store %struct.ListNode* %12, %struct.ListNode** %3
%13 = call i32 @print(%struct.ListNode* %12)
ret i32 0
}