#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 getLowerValuePosition(int *, int, int);
int getScrambledSize(int *, int);
scalar_t__ isScrambled(int *, int);
int /*<<< orphan*/ quicksort(int *, int, int);
int /*<<< orphan*/ swap(int *, int *);
void getCombination(int numbers[], int lenght, int combination) {
  int j, end, size, position;
  end = lenght - 1;
  size = getScrambledSize(numbers, lenght);
  j = lenght - size;
  combination--;
  while (combination) {
    if (isScrambled(numbers + j, size)) {
      position = getLowerValuePosition(numbers + j, numbers[j - 1], size);
      swap(&numbers[j - 1], &numbers[j + position]);
      quicksort(numbers, j, end);
    }
    size = getScrambledSize(numbers, lenght);
    j = lenght - size;
    combination--;
  }
}


x86 assembly (clang, -O0):
<getCombination>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <getScrambledSize@plt>
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1241 <getCombination+0xf1>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x1c(%rbp),%esi
call   1060 <isScrambled@plt>
cmp    $0x0,%rax
je     121b <getCombination+0xcb>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x1c(%rbp),%edx
call   1050 <getLowerValuePosition@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%eax
add    -0x20(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
call   1070 <swap@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <quicksort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <getScrambledSize@plt>
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    118c <getCombination+0x3c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCombination>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%r13d
mov    %esi,%r14d
mov    %rdi,%r15
call   1040 <getScrambledSize@plt>
add    $0xffffffff,%r13d
je     11fa <getCombination+0xaa>
mov    %eax,%ebp
lea    -0x1(%r14),%eax
mov    %eax,0xc(%rsp)
mov    %r14,0x10(%rsp)
jmp    11a3 <getCombination+0x53>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14d,%esi
call   1040 <getScrambledSize@plt>
mov    %eax,%ebp
add    $0xffffffff,%r13d
je     11fa <getCombination+0xaa>
mov    %r14d,%eax
sub    %ebp,%eax
movslq %eax,%rbx
lea    (%r15,%rbx,4),%r12
mov    %r12,%rdi
mov    %ebp,%esi
call   1060 <isScrambled@plt>
test   %rax,%rax
je     1190 <getCombination+0x40>
lea    (%r15,%rbx,4),%r14
add    $0xfffffffffffffffc,%r14
mov    -0x4(%r15,%rbx,4),%esi
mov    %r12,%rdi
mov    %ebp,%edx
call   1050 <getLowerValuePosition@plt>
add    %ebx,%eax
cltq
lea    (%r15,%rax,4),%rsi
mov    %r14,%rdi
mov    0x10(%rsp),%r14
call   1070 <swap@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    0xc(%rsp),%edx
call   1030 <quicksort@plt>
jmp    1190 <getCombination+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @getCombination(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 1
store i32 %12, i32* %8
%13 = load i32*, i32** %4
%14 = load i32, i32* %5
%15 = call i32 @getScrambledSize(i32* %13, i32 %14)
store i32 %15, i32* %9
%16 = load i32, i32* %5
%17 = load i32, i32* %9
%18 = sub nsw i32 %16, %17
store i32 %18, i32* %7
%19 = load i32, i32* %6
%20 = add nsw i32 %19, -1
store i32 %20, i32* %6
br label %21
21: ; preds = %61, %3
%22 = load i32, i32* %6
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %70
24: ; preds = %21
%25 = load i32*, i32** %4
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %9
%30 = call i64 @isScrambled(i32* %28, i32 %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %61
32: ; preds = %24
%33 = load i32*, i32** %4
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %33, i64 %35
%37 = load i32*, i32** %4
%38 = load i32, i32* %7
%39 = sub nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %37, i64 %40
%42 = load i32, i32* %41
%43 = load i32, i32* %9
%44 = call i32 @getLowerValuePosition(i32* %36, i32 %42, i32 %43)
store i32 %44, i32* %10
%45 = load i32*, i32** %4
%46 = load i32, i32* %7
%47 = sub nsw i32 %46, 1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32, i32* %45, i64 %48
%50 = load i32*, i32** %4
%51 = load i32, i32* %7
%52 = load i32, i32* %10
%53 = add nsw i32 %51, %52
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i32, i32* %50, i64 %54
%56 = call i32 @swap(i32* %49, i32* %55)
%57 = load i32*, i32** %4
%58 = load i32, i32* %7
%59 = load i32, i32* %8
%60 = call i32 @quicksort(i32* %57, i32 %58, i32 %59)
br label %61
61: ; preds = %32, %24
%62 = load i32*, i32** %4
%63 = load i32, i32* %5
%64 = call i32 @getScrambledSize(i32* %62, i32 %63)
store i32 %64, i32* %9
%65 = load i32, i32* %5
%66 = load i32, i32* %9
%67 = sub nsw i32 %65, %66
store i32 %67, i32* %7
%68 = load i32, i32* %6
%69 = add nsw i32 %68, -1
store i32 %69, i32* %6
br label %21
70: ; preds = %21
ret void
}

LLVM IR (-O2):
define void @getCombination(i32* %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, -1
%5 = tail call i32 @getScrambledSize(i32* %0, i32 %1)
%6 = add nsw i32 %2, -1
%7 = icmp eq i32 %6, 0
br i1 %7, label %31, label %8
8: ; preds = %3, %27
%9 = phi i32 [ %29, %27 ], [ %6, %3 ]
%10 = phi i32 [ %28, %27 ], [ %5, %3 ]
%11 = sub nsw i32 %1, %10
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = tail call i64 @isScrambled(i32* %13, i32 %10)
%15 = icmp eq i64 %14, 0
br i1 %15, label %27, label %16
16: ; preds = %8
%17 = add nsw i32 %11, -1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = load i32, i32* %19
%21 = tail call i32 @getLowerValuePosition(i32* %13, i32 %20, i32 %10)
%22 = add nsw i32 %21, %11
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %0, i64 %23
%25 = tail call i32 @swap(i32* %19, i32* %24)
%26 = tail call i32 @quicksort(i32* %0, i32 %11, i32 %4)
br label %27
27: ; preds = %16, %8
%28 = tail call i32 @getScrambledSize(i32* %0, i32 %1)
%29 = add nsw i32 %9, -1
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %8
31: ; preds = %27, %3
ret void
}