#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 */
scalar_t__ SUBSET_SUM_R(int *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ deDupR(int *, int /*<<< orphan*/, int, int *);
int /*<<< orphan*/ insertionSort_R(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int arr[] = {5, 9, 8, 4, 5, 4, 365, 65};
  int size = 8;
  insertionSort_R(arr, 0, size - 1);
  deDupR(arr, 0, size - 1, &size);
  int i = 0;
  for (i = 0; i < size; i++) {
    printf("%d ", arr[i]);
  }
  if (SUBSET_SUM_R(arr, 0, size - 1, 457))
    printf("\nYes possible");
  else
    printf("\nNo not possible");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x8,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1060 <insertionSort_R@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
lea    -0x34(%rbp),%rcx
call   1050 <deDupR@plt>
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11e6 <main+0xa6>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11b6 <main+0x76>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1c9,%ecx
call   1040 <SUBSET_SUM_R@plt>
cmp    $0x0,%rax
je     1219 <main+0xd9>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1227 <main+0xe7>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movaps 0xec2(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xea6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x8,0xc(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1060 <insertionSort_R@plt>
lea    0xc(%rsp),%rcx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1050 <deDupR@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    11bc <main+0x7c>
lea    0xe82(%rip),%r14
xor    %ebx,%ebx
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rdx
cmp    %rdx,%rbx
jl     11a0 <main+0x60>
add    $0xffffffff,%edx
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x1c9,%ecx
call   1040 <SUBSET_SUM_R@plt>
test   %rax,%rax
lea    0xe58(%rip),%rax
lea    0xe43(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.arr = [8 x i32] [i32 5, i32 9, i32 8, i32 4, i32 5, i32 4, i32 365, i32 65]
@.str = [4 x i8] c"%d \00"
@.str.1 = [14 x i8] c"\0AYes possible\00"
@.str.2 = [17 x i8] c"\0ANo not possible\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [8 x i32]* %2 to i8*
store i32 8, i32* %3
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%7 = load i32, i32* %3
%8 = sub nsw i32 %7, 1
%9 = call i32 @insertionSort_R(i32* %6, i32 0, i32 %8)
%10 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 1
%13 = call i32 @deDupR(i32* %10, i32 0, i32 %12, i32* %3)
store i32 0, i32* %4
store i32 0, i32* %4
br label %14
14: ; preds = %24, %0
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %18
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %14
27: ; preds = %14
%28 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%29 = load i32, i32* %3
%30 = sub nsw i32 %29, 1
%31 = call i64 @SUBSET_SUM_R(i32* %28, i32 0, i32 %30, i32 457)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %27
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %37
35: ; preds = %27
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [8 x i32] [i32 5, i32 9, i32 8, i32 4, i32 5, i32 4, i32 365, i32 65]
@.str = [4 x i8] c"%d \00"
@.str.1 = [14 x i8] c"\0AYes possible\00"
@.str.2 = [17 x i8] c"\0ANo not possible\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = alloca i32
%3 = bitcast [8 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 8, i32* %2
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%6 = call i32 @insertionSort_R(i32* %5, i32 0, i32 7)
%7 = call i32 @deDupR(i32* %5, i32 0, i32 7, i32* %2)
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %0, %10
%11 = phi i64 [ %15, %10 ], [ 0, %0 ]
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = add nuw nsw i64 %11, 1
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = icmp slt i64 %15, %17
br i1 %18, label %10, label %19
19: ; preds = %10, %0
%20 = phi i32 [ %8, %0 ], [ %16, %10 ]
%21 = add nsw i32 %20, -1
%22 = call i64 @SUBSET_SUM_R(i32* %5, i32 0, i32 %21, i32 457)
%23 = icmp eq i64 %22, 0
%24 = select i1 %23, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %24)
ret i32 0
}