#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 do_combine_letters(const char *letters, char *printer, int printer_len,
                        int letters_len, int start_letter) {
  for (int i = start_letter; i < letters_len; i++) {
    printer[printer_len] = letters[i];
    printf("%s\n", printer);
    if (i < letters_len - 1) {
      do_combine_letters(letters, printer, printer_len + 1, letters_len, i + 1);
    }
    printer[printer_len] = '\0';
  }
}


x86 assembly (clang, -O0):
<do_combine_letters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11bb <do_combine_letters+0x9b>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11a1 <do_combine_letters+0x81>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%r8d
add    $0x1,%r8d
call   1040 <do_combine_letters@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1140 <do_combine_letters+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_combine_letters>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,0x8(%rsp)
cmp    %ecx,%r8d
jge    11c4 <do_combine_letters+0xa4>
mov    %r8d,%ebx
mov    %rsi,%r15
mov    %rdi,%r12
movslq %edx,%r13
mov    0x8(%rsp),%r14
lea    -0x1(%r14),%eax
lea    0x1(%r13),%ecx
mov    %ecx,0x4(%rsp)
movslq %r8d,%rbp
cltq
mov    %rax,0x10(%rsp)
neg    %r14d
add    $0x1,%ebx
jmp    118c <do_combine_letters+0x6c>
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%r15,%r13,1)
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
add    $0x1,%rbp
mov    %ecx,%ebx
cmp    $0x1,%eax
je     11c4 <do_combine_letters+0xa4>
movzbl (%r12,%rbp,1),%eax
mov    %al,(%r15,%r13,1)
lea    0xe64(%rip),%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
cmp    0x10(%rsp),%rbp
jge    1170 <do_combine_letters+0x50>
mov    %r12,%rdi
mov    %r15,%rsi
mov    0x4(%rsp),%edx
mov    0x8(%rsp),%rcx
mov    %ebx,%r8d
call   1040 <do_combine_letters@plt>
jmp    1170 <do_combine_letters+0x50>
add    $0x18,%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 @do_combine_letters(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load i32, i32* %10
store i32 %12, i32* %11
br label %13
13: ; preds = %46, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %9
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %49
17: ; preds = %13
%18 = load i8*, i8** %6
%19 = load i32, i32* %11
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = load i8*, i8** %7
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 %22, i8* %26
%27 = load i8*, i8** %7
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = load i32, i32* %11
%30 = load i32, i32* %9
%31 = sub nsw i32 %30, 1
%32 = icmp slt i32 %29, %31
br i1 %32, label %33, label %41
33: ; preds = %17
%34 = load i8*, i8** %6
%35 = load i8*, i8** %7
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
%38 = load i32, i32* %9
%39 = load i32, i32* %11
%40 = add nsw i32 %39, 1
br label %41
41: ; preds = %33, %17
%42 = load i8*, i8** %7
%43 = load i32, i32* %8
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
store i8 0, i8* %45
br label %46
46: ; preds = %41
%47 = load i32, i32* %11
%48 = add nsw i32 %47, 1
store i32 %48, i32* %11
br label %13
49: ; preds = %13
ret void
}

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