#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*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printComb(char *, int, int /*<<< orphan*/, int, int *);
int /*<<< orphan*/ printf(char *);
void printAllComb(char *str, int size) {
  int combLen, id;
  int *selectionMark = (int *)malloc(sizeof(int) * size);
  printf("empty\n");
  for (combLen = 1; combLen <= size; combLen++) {
    for (id = 0; id < size; id++)
      selectionMark[id] = 0;
    printComb(str, size, 0, combLen, selectionMark);
  }
  free(selectionMark);
}


x86 assembly (clang, -O0):
<printAllComb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11d4 <printAllComb+0x94>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b1 <printAllComb+0x71>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1188 <printAllComb+0x48>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%ecx
mov    -0x20(%rbp),%r8
xor    %edx,%edx
call   1060 <printComb@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1175 <printAllComb+0x35>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printAllComb>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x0(,%r15,4),%edi
call   1060 <malloc@plt>
mov    %rax,%r13
lea    0xe88(%rip),%rdi
call   1040 <puts@plt>
test   %r15d,%r15d
jle    11d1 <printAllComb+0x81>
mov    %r15d,%r12d
shl    $0x2,%r12
mov    %r15d,%ebp
neg    %ebp
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
xor    %esi,%esi
mov    %r12,%rdx
call   1050 <memset@plt>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %edx,%edx
mov    %ebx,%ecx
mov    %r13,%r8
call   1070 <printComb@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    11a0 <printAllComb+0x50>
mov    %r13,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"empty\0A\00"
define void @printAllComb(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = mul i64 4, %9
%11 = trunc i64 %10 to i32
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %7
%14 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %5
br label %15
15: ; preds = %38, %2
%16 = load i32, i32* %5
%17 = load i32, i32* %4
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %41
19: ; preds = %15
store i32 0, i32* %6
br label %20
20: ; preds = %29, %19
%21 = load i32, i32* %6
%22 = load i32, i32* %4
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %32
24: ; preds = %20
%25 = load i32*, i32** %7
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
store i32 0, i32* %28
br label %29
29: ; preds = %24
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %20
32: ; preds = %20
%33 = load i8*, i8** %3
%34 = load i32, i32* %4
%35 = load i32, i32* %5
%36 = load i32*, i32** %7
%37 = call i32 @printComb(i8* %33, i32 %34, i32 0, i32 %35, i32* %36)
br label %38
38: ; preds = %32
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %15
41: ; preds = %15
%42 = load i32*, i32** %7
%43 = call i32 @free(i32* %42)
ret void
}

LLVM IR (-O2):
@str = [6 x i8] c"empty\00"
define void @printAllComb(i8* %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i32*
%6 = inttoptr i64 %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%8 = icmp slt i32 %1, 1
br i1 %8, label %17, label %9
9: ; preds = %2
%10 = zext i32 %1 to i64
%11 = shl nuw nsw i64 %10, 2
br label %12
12: ; preds = %9, %12
%13 = phi i32 [ 1, %9 ], [ %15, %12 ]
%14 = tail call i32 @printComb(i8* %0, i32 %1, i32 0, i32 %13, i32* %5)
%15 = add nuw i32 %13, 1
%16 = icmp eq i32 %13, %1
br i1 %16, label %17, label %12
17: ; preds = %12, %2
%18 = tail call i32 @free(i32* %5)
ret void
}