#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*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
char *strncat(char *, char *, int);
void recurseme(char *a, int asz, int times, char *s) {
  int i;
  if (times >= 0) {
    for (i = 0; i < asz; ++i) {
      recurseme(a, asz, times - 1, strncat(s, &a[i], 1));
    }
  } else {
    printf("%s\n", s);
    memset(s, 0, 128 * sizeof(char));
  }
  return;
}


x86 assembly (clang, -O0):
<recurseme>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     11c8 <recurseme+0x88>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c3 <recurseme+0x83>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
mov    $0x1,%edx
call   1050 <strncat@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    %rax,%rcx
call   1060 <recurseme@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1167 <recurseme+0x27>
jmp    11e8 <recurseme+0xa8>
mov    -0x18(%rbp),%rsi
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recurseme>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
test   %edx,%edx
js     11aa <recurseme+0x6a>
mov    %esi,%r15d
test   %esi,%esi
jle    119b <recurseme+0x5b>
mov    %edx,%r12d
mov    %rdi,%rbx
add    $0xffffffff,%r12d
mov    %r15d,%r13d
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%rsi
mov    %r14,%rdi
mov    $0x1,%edx
call   1050 <strncat@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %rax,%rcx
call   1060 <recurseme@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1170 <recurseme+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe4f(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x80,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <memset@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @recurseme(i8* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i32, i32* %7
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %32
12: ; preds = %4
store i32 0, i32* %9
br label %13
13: ; preds = %28, %12
%14 = load i32, i32* %9
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %31
17: ; preds = %13
%18 = load i8*, i8** %5
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = sub nsw i32 %20, 1
%22 = load i8*, i8** %8
%23 = load i8*, i8** %5
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = call i8* @strncat(i8* %22, i8* %26, i32 1)
br label %28
28: ; preds = %17
%29 = load i32, i32* %9
%30 = add nsw i32 %29, 1
store i32 %30, i32* %9
br label %13
31: ; preds = %13
br label %37
32: ; preds = %4
%33 = load i8*, i8** %8
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %33)
%35 = load i8*, i8** %8
%36 = call i32 @memset(i8* %35, i32 0, i32 128)
br label %37
37: ; preds = %32, %31
ret void
}

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