#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int removeElement(int *, int, int);
int main() {
  int n[] = {4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10};
  int l = removeElement(n, 18, 5);
  for (int i = 0; i < l; i++)
    printf("%d ", n[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x48,%edx
call   1050 <memcpy@plt>
lea    -0x50(%rbp),%rdi
mov    $0x12,%esi
mov    $0x5,%edx
call   1030 <removeElement@plt>
mov    %eax,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    119f <main+0x6f>
movslq -0x58(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1171 <main+0x41>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    0xf10(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xef4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea0(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x12,%esi
mov    $0x5,%edx
call   1030 <removeElement@plt>
test   %eax,%eax
jle    11a4 <main+0x84>
mov    %eax,%r15d
xor    %ebx,%ebx
lea    0xec2(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1190 <main+0x70>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.n = [18 x i32] [i32 4, i32 4, i32 4, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 10, i32 10, i32 10, i32 10]
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [18 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [18 x i32]* %2 to i8*
%6 = getelementptr inbounds [18 x i32], [18 x i32]* %2, i64 0, i64 0
%7 = call i32 @removeElement(i32* %6, i32 18, i32 5)
store i32 %7, i32* %3
store i32 0, i32* %4
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [18 x i32], [18 x i32]* %2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %12
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %8
21: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@__const.main.n = [18 x i32] [i32 4, i32 4, i32 4, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 10, i32 10, i32 10, i32 10]
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [18 x i32]
%2 = bitcast [18 x i32]* %1 to i8*
%3 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 0
%4 = call i32 @removeElement(i32* %3, i32 18, i32 5)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = zext i32 %4 to i64
br label %9
8: ; preds = %9, %0
ret i32 0
9: ; preds = %6, %9
%10 = phi i64 [ 0, %6 ], [ %14, %9 ]
%11 = getelementptr inbounds [18 x i32], [18 x i32]* %1, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, %7
br i1 %15, label %8, label %9
}