#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);
void printPartition(int *arr, int length) {
  int ind;
  for (ind = 0; ind < length - 1; ind++) {
    if (arr[ind] >= arr[ind + 1]) {
      return;
    }
  }
  for (ind = 0; ind < length - 1; ind++) {
    printf("%d + ", arr[ind]);
  }
  printf("%d\n", arr[length - 1]);
}


x86 assembly (clang, -O0):
<printPartition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1170 <printPartition+0x60>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jl     115d <printPartition+0x4d>
jmp    11c9 <printPartition+0xb9>
jmp    1162 <printPartition+0x52>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printPartition+0x16>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11ad <printPartition+0x9d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1177 <printPartition+0x67>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPartition>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rbx
lea    -0x1(%rsi),%r15d
xor    %eax,%eax
test   %r15d,%r15d
mov    $0x0,%ecx
cmovg  %r15d,%ecx
nopl   (%rax)
cmp    %rax,%rcx
je     114e <printPartition+0x3e>
mov    (%rbx,%rax,4),%edx
lea    0x1(%rax),%rdi
cmp    0x4(%rbx,%rax,4),%edx
mov    %rdi,%rax
jl     1130 <printPartition+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x2,%esi
jl     1174 <printPartition+0x64>
mov    %r15d,%r12d
xor    %ebp,%ebp
lea    0xea1(%rip),%r14
nop
mov    (%rbx,%rbp,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1160 <printPartition+0x50>
movslq %r15d,%rax
mov    (%rbx,%rax,4),%esi
lea    0xe85(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%d + \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @printPartition(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %26, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
%10 = icmp slt i32 %7, %9
br i1 %10, label %11, label %29
11: ; preds = %6
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = load i32*, i32** %3
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %17, i64 %20
%22 = load i32, i32* %21
%23 = icmp sge i32 %16, %22
br i1 %23, label %24, label %25
24: ; preds = %11
br label %53
25: ; preds = %11
br label %26
26: ; preds = %25
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %6
29: ; preds = %6
store i32 0, i32* %5
br label %30
30: ; preds = %42, %29
%31 = load i32, i32* %5
%32 = load i32, i32* %4
%33 = sub nsw i32 %32, 1
%34 = icmp slt i32 %31, %33
br i1 %34, label %35, label %45
35: ; preds = %30
%36 = load i32*, i32** %3
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
%40 = load i32, i32* %39
%41 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %35
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %30
45: ; preds = %30
%46 = load i32*, i32** %3
%47 = load i32, i32* %4
%48 = sub nsw i32 %47, 1
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i32, i32* %46, i64 %49
%51 = load i32, i32* %50
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %45, %24
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d + \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @printPartition(i32* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = call i32 @llvm.smax.i32(i32 %3, i32 0)
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %13, %2
%7 = phi i64 [ %16, %13 ], [ 0, %2 ]
%8 = icmp eq i64 %7, %5
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = icmp sgt i32 %1, 1
br i1 %10, label %11, label %27
11: ; preds = %9
%12 = zext i32 %3 to i64
br label %20
13: ; preds = %6
%14 = getelementptr inbounds i32, i32* %0, i64 %7
%15 = load i32, i32* %14
%16 = add nuw nsw i64 %7, 1
%17 = getelementptr inbounds i32, i32* %0, i64 %16
%18 = load i32, i32* %17
%19 = icmp slt i32 %15, %18
br i1 %19, label %6, label %32
20: ; preds = %11, %20
%21 = phi i64 [ 0, %11 ], [ %25, %20 ]
%22 = getelementptr inbounds i32, i32* %0, i64 %21
%23 = load i32, i32* %22
%24 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = add nuw nsw i64 %21, 1
%26 = icmp eq i64 %25, %12
br i1 %26, label %27, label %20
27: ; preds = %20, %9
%28 = sext i32 %3 to i64
%29 = getelementptr inbounds i32, i32* %0, i64 %28
%30 = load i32, i32* %29
%31 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %13, %27
ret void
}