#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*/ do_combine_letters(char const *, char *, int /*<<< orphan*/,
                                      int, int /*<<< orphan*/);
void combine_letters(const char *letters, int len) {
  char printer[len];
  for (int i = 0; i < len; i++) {
    printer[i] = '\0';
  }
  do_combine_letters(letters, printer, 0, len, 0);
}


x86 assembly (clang, -O0):
<combine_letters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1172 <combine_letters+0x62>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114c <combine_letters+0x3c>
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
xor    %r8d,%r8d
mov    %r8d,%edx
call   1030 <do_combine_letters@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<combine_letters>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
mov    %esi,%edx
mov    %rsp,%rbx
lea    0xf(%rdx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
test   %esi,%esi
jle    1151 <combine_letters+0x31>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    %r15d,%ecx
xor    %r8d,%r8d
call   1040 <do_combine_letters@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @combine_letters(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %5
%11 = alloca i8, i64 %9
store i64 %9, i64* %6
store i32 0, i32* %7
br label %12
12: ; preds = %20, %2
%13 = load i32, i32* %7
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %11, i64 %18
store i8 0, i8* %19
br label %20
20: ; preds = %16
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %12
23: ; preds = %12
%24 = load i8*, i8** %3
%25 = load i32, i32* %4
%26 = call i32 @do_combine_letters(i8* %24, i8* %11, i32 0, i32 %25, i32 0)
%27 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
define void @combine_letters(i8* %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = alloca i8, i64 %3
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %7
6: ; preds = %2
br label %7
7: ; preds = %6, %2
%8 = call i32 @do_combine_letters(i8* %0, i8* %4, i32 0, i32 %1, i32 0)
ret void
}