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


x86 assembly (clang, -O0):
<recurseme>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     11a3 <recurseme+0x83>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119e <recurseme+0x7e>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    %r8d,%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
call   1040 <recurseme@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114b <recurseme+0x2b>
jmp    11ba <recurseme+0x9a>
mov    -0x18(%rbp),%rsi
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
add    $0x20,%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,%r15
test   %edx,%edx
js     1199 <recurseme+0x79>
test   %esi,%esi
jle    118a <recurseme+0x6a>
mov    %edx,%r12d
mov    %rdi,%rbx
mov    %esi,%ebp
add    $0xffffffff,%r12d
movslq %r8d,%rax
lea    (%r15,%rax,1),%rsi
mov    %rsi,(%rsp)
mov    %eax,%r13d
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rbx,%r14,1),%eax
mov    (%rsp),%rsi
mov    %al,(%rsi,%r14,1)
lea    (%r14,%r13,1),%r8d
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r15,%rcx
call   1040 <recurseme@plt>
add    $0x1,%r14
cmp    %r14,%rbp
jne    1160 <recurseme+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe60(%rip),%rdi
mov    %r15,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

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

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