#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 *, char *);
void print_combinations_aux(const char *str, size_t str_sz, size_t str_i,
                            char *buff, size_t buff_i) {
  if (str_i == str_sz) {
    buff[buff_i] = '\0';
    if (buff_i != 0) {
      printf("%s\n", buff);
    }
    return;
  }
  print_combinations_aux(str, str_sz, str_i + 1, buff, buff_i);
  buff[buff_i] = str[str_i];
  print_combinations_aux(str, str_sz, str_i + 1, buff, buff_i + 1);
}


x86 assembly (clang, -O0):
<print_combinations_aux>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1176 <print_combinations_aux+0x56>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
cmpq   $0x0,-0x28(%rbp)
je     1171 <print_combinations_aux+0x51>
mov    -0x20(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
jmp    11ca <print_combinations_aux+0xaa>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x1,%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1040 <print_combinations_aux@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x1,%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
add    $0x1,%r8
call   1040 <print_combinations_aux@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_combinations_aux>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r15
mov    %rcx,%r14
cmp    %rsi,%rdx
je     1184 <print_combinations_aux+0x64>
mov    %rdx,%rbx
mov    %rsi,%r12
mov    %rdi,%r13
mov    %rsi,%rbp
neg    %rbp
add    $0x1,%rbx
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %r15,%r8
call   1040 <print_combinations_aux@plt>
movzbl -0x1(%r13,%rbx,1),%eax
mov    %al,(%r14,%r15,1)
add    $0x1,%r15
lea    (%rbx,%rbp,1),%rax
add    $0x1,%rax
add    $0x1,%rbx
cmp    $0x1,%rax
jne    1150 <print_combinations_aux+0x30>
movb   $0x0,(%r14,%r15,1)
test   %r15,%r15
je     11ab <print_combinations_aux+0x8b>
lea    0xe6b(%rip),%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @print_combinations_aux(i8* %0, i64 %1, i64 %2, i8* %3, i64 %4) {
%6 = icmp eq i64 %2, %1
br i1 %6, label %7, label %13
7: ; preds = %13, %5
%8 = phi i64 [ %4, %5 ], [ %20, %13 ]
%9 = getelementptr inbounds i8, i8* %3, i64 %8
store i8 0, i8* %9
%10 = icmp eq i64 %8, 0
br i1 %10, label %22, label %11
11: ; preds = %7
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %22
13: ; preds = %5, %13
%14 = phi i64 [ %20, %13 ], [ %4, %5 ]
%15 = phi i64 [ %16, %13 ], [ %2, %5 ]
%16 = add i64 %15, 1
tail call void @print_combinations_aux(i8* %0, i64 %1, i64 %16, i8* %3, i64 %14)
%17 = getelementptr inbounds i8, i8* %0, i64 %15
%18 = load i8, i8* %17
%19 = getelementptr inbounds i8, i8* %3, i64 %14
store i8 %18, i8* %19
%20 = add i64 %14, 1
%21 = icmp eq i64 %16, %1
br i1 %21, label %7, label %13
22: ; preds = %7, %11
ret void
}