#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*/ printArray(int *, int);
void printPartitionHelper(int summandList[], int summandListCount, int number,
                          int maxSummand) {
  if (number == 0) {
    printArray(summandList, summandListCount);
  } else if (maxSummand > number) {
    printPartitionHelper(summandList, summandListCount, number, number);
  } else {
    int summand;
    for (summand = maxSummand; summand >= 1; summand--) {
      summandList[summandListCount] = summand;
      printPartitionHelper(summandList, summandListCount + 1, number - summand,
                           summand);
    }
  }
}


x86 assembly (clang, -O0):
<printPartitionHelper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1150 <printPartitionHelper+0x30>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <printArray@plt>
jmp    11c1 <printPartitionHelper+0xa1>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1173 <printPartitionHelper+0x53>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <printPartitionHelper@plt>
jmp    11bc <printPartitionHelper+0x9c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jl     11b7 <printPartitionHelper+0x97>
mov    -0x18(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
sub    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1040 <printPartitionHelper@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1179 <printPartitionHelper+0x59>
jmp    11bc <printPartitionHelper+0x9c>
jmp    11c1 <printPartitionHelper+0xa1>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPartitionHelper>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
test   %edx,%edx
je     1179 <printPartitionHelper+0x59>
mov    %ecx,%ebx
mov    %edx,%ebp
cmp    %edx,%ecx
cmovg  %edx,%ebx
test   %ebx,%ebx
jle    1170 <printPartitionHelper+0x50>
movslq %esi,%r12
lea    0x1(%r12),%r15d
sub    %ebx,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,(%r14,%r12,4)
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1040 <printPartitionHelper@plt>
lea    -0x1(%rbx),%eax
add    $0x1,%ebp
cmp    $0x1,%ebx
mov    %eax,%ebx
ja     1150 <printPartitionHelper+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printArray@plt>

LLVM IR (-O0):
define void @printPartitionHelper(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %7
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %4
%13 = load i32*, i32** %5
%14 = load i32, i32* %6
%15 = call i32 @printArray(i32* %13, i32 %14)
br label %48
16: ; preds = %4
%17 = load i32, i32* %8
%18 = load i32, i32* %7
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = load i32*, i32** %5
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = load i32, i32* %7
br label %47
25: ; preds = %16
%26 = load i32, i32* %8
store i32 %26, i32* %9
br label %27
27: ; preds = %43, %25
%28 = load i32, i32* %9
%29 = icmp sge i32 %28, 1
br i1 %29, label %30, label %46
30: ; preds = %27
%31 = load i32, i32* %9
%32 = load i32*, i32** %5
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
store i32 %31, i32* %35
%36 = load i32*, i32** %5
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
%39 = load i32, i32* %7
%40 = load i32, i32* %9
%41 = sub nsw i32 %39, %40
%42 = load i32, i32* %9
br label %43
43: ; preds = %30
%44 = load i32, i32* %9
%45 = add nsw i32 %44, -1
store i32 %45, i32* %9
br label %27
46: ; preds = %27
br label %47
47: ; preds = %46, %20
br label %48
48: ; preds = %47, %12
ret void
}

LLVM IR (-O2):
define void @printPartitionHelper(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %2, 0
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = icmp sgt i32 %3, %2
%8 = select i1 %7, i32 %2, i32 %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %12, label %21
10: ; preds = %4
%11 = tail call i32 @printArray(i32* %0, i32 %1)
br label %21
12: ; preds = %6
%13 = sext i32 %1 to i64
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = add nsw i32 %1, 1
br label %16
16: ; preds = %12, %16
%17 = phi i32 [ %8, %12 ], [ %19, %16 ]
store i32 %17, i32* %14
%18 = sub nsw i32 %2, %17
tail call void @printPartitionHelper(i32* %0, i32 %15, i32 %18, i32 %17)
%19 = add nsw i32 %17, -1
%20 = icmp ugt i32 %17, 1
br i1 %20, label %16, label %21
21: ; preds = %16, %6, %10
ret void
}