#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);
int sum_solve(int *, int, int *, int, int);
int /*<<< orphan*/ sum_sovle_result_space(int *, int, int);
int test() {
  int set[] = {1, 3, 5};
  int num = 3;
  int dp[36];
  int size = 36;
  for (int i = 0; i < size; i++)
    dp[i] = -1;
  int n = 6;
  printf("%d:%d\n", n, sum_solve(dp, size, set, num, n));
  sum_sovle_result_space(set, num, n);
  return 0;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    0xebe(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xebc(%rip),%eax
mov    %eax,-0x4(%rbp)
movl   $0x3,-0x10(%rbp)
movl   $0x24,-0xa4(%rbp)
movl   $0x0,-0xa8(%rbp)
mov    -0xa8(%rbp),%eax
cmp    -0xa4(%rbp),%eax
jge    11a2 <test+0x72>
movslq -0xa8(%rbp),%rax
movl   $0xffffffff,-0xa0(%rbp,%rax,4)
ff ff ff ff
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    116a <test+0x3a>
movl   $0x6,-0xac(%rbp)
mov    -0xac(%rbp),%eax
mov    %eax,-0xb0(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0xa4(%rbp),%esi
lea    -0xc(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    -0xac(%rbp),%r8d
call   1050 <sum_solve@plt>
mov    -0xb0(%rbp),%esi
mov    %eax,%edx
lea    0xe25(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xac(%rbp),%edx
call   1040 <sum_sovle_result_space@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
sub    $0xa0,%rsp
mov    0xeca(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xeb7(%rip),%rax
mov    %rax,(%rsp)
pcmpeqd %xmm0,%xmm0
movdqa %xmm0,0x90(%rsp)
movdqa %xmm0,0x80(%rsp)
movdqa %xmm0,0x70(%rsp)
movdqa %xmm0,0x60(%rsp)
movdqa %xmm0,0x50(%rsp)
movdqa %xmm0,0x40(%rsp)
movdqa %xmm0,0x30(%rsp)
movdqa %xmm0,0x20(%rsp)
movdqa %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
mov    %rsp,%rbx
mov    $0x24,%esi
mov    %rbx,%rdx
mov    $0x3,%ecx
mov    $0x6,%r8d
call   1050 <sum_solve@plt>
lea    0xe58(%rip),%rdi
mov    $0x6,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x6,%edx
call   1040 <sum_sovle_result_space@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.test.set = [3 x i32] [i32 1, i32 3, i32 5]
@.str = [7 x i8] c"%d:%d\0A\00"
define i32 @test() {
%1 = alloca [3 x i32]
%2 = alloca i32
%3 = alloca [36 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast [3 x i32]* %1 to i8*
store i32 3, i32* %2
store i32 36, i32* %4
store i32 0, i32* %5
br label %8
8: ; preds = %16, %0
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [36 x i32], [36 x i32]* %3, i64 0, i64 %14
store i32 -1, i32* %15
br label %16
16: ; preds = %12
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %8
19: ; preds = %8
store i32 6, i32* %6
%20 = load i32, i32* %6
%21 = getelementptr inbounds [36 x i32], [36 x i32]* %3, i64 0, i64 0
%22 = load i32, i32* %4
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%24 = load i32, i32* %2
%25 = load i32, i32* %6
%26 = call i32 @sum_solve(i32* %21, i32 %22, i32* %23, i32 %24, i32 %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %26)
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%29 = load i32, i32* %2
%30 = load i32, i32* %6
%31 = call i32 @sum_sovle_result_space(i32* %28, i32 %29, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@__const.test.set = [3 x i32] [i32 1, i32 3, i32 5]
@.str = [7 x i8] c"%d:%d\0A\00"
define i32 @test() {
%1 = alloca [3 x i32]
%2 = alloca [36 x i32]
%3 = bitcast [36 x i32]* %2 to i8*
%4 = bitcast [3 x i32]* %1 to i8*
%5 = getelementptr inbounds [36 x i32], [36 x i32]* %2, i64 0, i64 0
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%7 = call i32 @sum_solve(i32* %5, i32 36, i32* %6, i32 3, i32 6)
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6, i32 %7)
%9 = call i32 @sum_sovle_result_space(i32* %6, i32 3, i32 6)
ret i32 0
}