#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 */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int remove_min(int *, int);
int remove_min_dp(int *, int /*<<< orphan*/, int);
void main() {
  int a[] = {4, 5, 100, 9, 10, 11, 12, 15, 200};
  int len = sizeof(a) / sizeof(a[0]);
  printf("Min removals = %d ", remove_min(a, len));
  printf("Min removals = %d ", remove_min_dp(a, 0, len - 1));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
movl   $0x9,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <remove_min@plt>
mov    %eax,%esi
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1060 <remove_min_dp@plt>
mov    %eax,%esi
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0xee3(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x9,%esi
call   1030 <remove_min@plt>
lea    0xeb5(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1050 <remove_min_dp@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.a = [9 x i32] [i32 4, i32 5, i32 100, i32 9, i32 10, i32 11, i32 12, i32 15, i32 200]
@.str = [19 x i8] c"Min removals = %d \00"
define void @main() {
%1 = alloca [9 x i32]
%2 = alloca i32
%3 = bitcast [9 x i32]* %1 to i8*
store i32 9, i32* %2
%4 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @remove_min(i32* %4, i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 1
%11 = call i32 @remove_min_dp(i32* %8, i32 0, i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %11)
ret void
}

LLVM IR (-O2):
@__const.main.a = [9 x i32] [i32 4, i32 5, i32 100, i32 9, i32 10, i32 11, i32 12, i32 15, i32 200]
@.str = [19 x i8] c"Min removals = %d \00"
define void @main() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%4 = call i32 @remove_min(i32* %3, i32 9)
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @remove_min_dp(i32* %3, i32 0, i32 8)
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}