#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 removeElement(int *, int, int);
int main(int argc, char *argv[]) {
  int nums[] = {1, 1, 1, 2, 2, 4};
  if (!(removeElement(nums, 0, 1) == 0)) {
    printf("assert fail: %s\n", "boundary 0");
    return -1;
  };
  if (!(removeElement(nums, 1, 1) == 0)) {
    printf("assert fail: %s\n", "boundary 1");
    return -1;
  };
  if (!(removeElement(nums, 1, 2) == 1)) {
    printf("assert fail: %s\n", "boundary 1 for not exist");
    return -1;
  };
  if (!(removeElement(nums, 6, 1) == 3)) {
    printf("assert fail: %s\n", "test for length 6");
    return -1;
  };
  printf("everything is fine!\n");
  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    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <removeElement@plt>
cmp    $0x0,%eax
je     1191 <main+0x71>
lea    0xea1(%rip),%rdi
lea    0xeab(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    125a <main+0x13a>
lea    -0x30(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <removeElement@plt>
cmp    $0x0,%eax
je     11cb <main+0xab>
lea    0xe67(%rip),%rdi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    125a <main+0x13a>
lea    -0x30(%rbp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <removeElement@plt>
cmp    $0x1,%eax
je     1208 <main+0xe8>
lea    0xe2a(%rip),%rdi
lea    0xe4a(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    125a <main+0x13a>
lea    -0x30(%rbp),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
call   1030 <removeElement@plt>
cmp    $0x3,%eax
je     1245 <main+0x125>
lea    0xded(%rip),%rdi
lea    0xe26(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    125a <main+0x13a>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xed5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <removeElement@plt>
test   %eax,%eax
je     1171 <main+0x41>
lea    0xeb3(%rip),%rdi
lea    0xebd(%rip),%rsi
jmp    11f6 <main+0xc6>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <removeElement@plt>
test   %eax,%eax
je     1197 <main+0x67>
lea    0xe8a(%rip),%rdi
lea    0xe9f(%rip),%rsi
jmp    11f6 <main+0xc6>
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   1040 <removeElement@plt>
cmp    $0x1,%eax
jne    11d8 <main+0xa8>
mov    %rsp,%rdi
mov    $0x6,%esi
mov    $0x1,%edx
call   1040 <removeElement@plt>
cmp    $0x3,%eax
jne    11e8 <main+0xb8>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
lea    0xe39(%rip),%rdi
lea    0xe59(%rip),%rsi
jmp    11f6 <main+0xc6>
lea    0xe29(%rip),%rdi
lea    0xe62(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.nums = [6 x i32] [i32 1, i32 1, i32 1, i32 2, i32 2, i32 4]
@.str = [17 x i8] c"assert fail: %s\0A\00"
@.str.1 = [11 x i8] c"boundary 0\00"
@.str.2 = [11 x i8] c"boundary 1\00"
@.str.3 = [25 x i8] c"boundary 1 for not exist\00"
@.str.4 = [18 x i8] c"test for length 6\00"
@.str.5 = [21 x i8] c"everything is fine!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [6 x i32]* %6 to i8*
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%9 = call i32 @removeElement(i32* %8, i32 0, i32 1)
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %33
13: ; preds = %2
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%15 = call i32 @removeElement(i32* %14, i32 1, i32 1)
%16 = icmp eq i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %33
19: ; preds = %13
%20 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%21 = call i32 @removeElement(i32* %20, i32 1, i32 2)
%22 = icmp eq i32 %21, 1
br i1 %22, label %25, label %23
23: ; preds = %19
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %33
25: ; preds = %19
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%27 = call i32 @removeElement(i32* %26, i32 6, i32 1)
%28 = icmp eq i32 %27, 3
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %33
31: ; preds = %25
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %33
33: ; preds = %31, %29, %23, %17, %11
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@__const.main.nums = [6 x i32] [i32 1, i32 1, i32 1, i32 2, i32 2, i32 4]
@.str = [17 x i8] c"assert fail: %s\0A\00"
@.str.1 = [11 x i8] c"boundary 0\00"
@.str.2 = [11 x i8] c"boundary 1\00"
@.str.3 = [25 x i8] c"boundary 1 for not exist\00"
@.str.4 = [18 x i8] c"test for length 6\00"
@str = [20 x i8] c"everything is fine!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i32]
%4 = bitcast [6 x i32]* %3 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%6 = call i32 @removeElement(i32* %5, i32 0, i32 1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %27
10: ; preds = %2
%11 = call i32 @removeElement(i32* %5, i32 1, i32 1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %27
15: ; preds = %10
%16 = call i32 @removeElement(i32* %5, i32 1, i32 2)
%17 = icmp eq i32 %16, 1
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %27
20: ; preds = %15
%21 = call i32 @removeElement(i32* %5, i32 6, i32 1)
%22 = icmp eq i32 %21, 3
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %27
25: ; preds = %20
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %27
27: ; preds = %25, %23, %18, %13, %8
%28 = phi i32 [ 0, %25 ], [ -1, %23 ], [ -1, %18 ], [ -1, %13 ], [ -1, %8 ]
ret i32 %28
}