#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*/ strcpy(char *, char *);
int strlen(char *);
void num_ending(char *pass, int cnt, void **nxt_f) {
  int lpass = strlen(pass);
  char pass_new[lpass + 2];
  pass_new[lpass] = 0x00;
  pass_new[lpass + 1] = 0x00;
  void (*func)(char *pass, int cnt, void **nxt_f) = *nxt_f;
  func(pass, 0, nxt_f + 1);
  strcpy(pass_new, pass);
  int i;
  for (i = 0; i < 10; i++) {
    pass_new[lpass] = (unsigned char)(i | 0x30);
    func(pass_new, 0, nxt_f + 1);
  }
}


x86 assembly (clang, -O0):
<num_ending>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x28(%rbp)
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,-0x48(%rbp)
mov    %rax,%rsp
mov    %rcx,-0x30(%rbp)
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
xor    %esi,%esi
call   *%rax
mov    -0x48(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    11ed <num_ending+0xcd>
mov    -0x48(%rbp),%rdi
mov    -0x3c(%rbp),%eax
or     $0x30,%eax
mov    %al,%cl
movslq -0x1c(%rbp),%rax
mov    %cl,(%rdi,%rax,1)
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
xor    %esi,%esi
call   *%rax
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11b2 <num_ending+0x92>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_ending>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%r15
call   1040 <strlen@plt>
lea    0x2(%rax),%ecx
mov    %rsp,%rbx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rbx
mov    %rbx,%rsp
movslq %eax,%r13
movw   $0x0,0x0(%r13,%rbx,1)
mov    (%r14),%r12
add    $0x8,%r14
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   *%r12
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
movb   $0x30,0x0(%r13,%rbx,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   *%r12
movb   $0x31,0x0(%r13,%rbx,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   *%r12
movb   $0x32,0x0(%r13,%rbx,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   *%r12
movb   $0x33,0x0(%r13,%rbx,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   *%r12
movb   $0x34,0x0(%r13,%rbx,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   *%r12
movb   $0x35,0x0(%r13,%rbx,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   *%r12
movb   $0x36,0x0(%r13,%rbx,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   *%r12
movb   $0x37,0x0(%r13,%rbx,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   *%r12
movb   $0x38,0x0(%r13,%rbx,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   *%r12
movb   $0x39,0x0(%r13,%rbx,1)
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   *%r12
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @num_ending(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca void (i8*, i32, i8**)*
%11 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 2
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %8
%18 = alloca i8, i64 %16
store i64 %16, i64* %9
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 0, i8* %21
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %18, i64 %24
store i8 0, i8* %25
%26 = load i8**, i8*** %6
%27 = load i8*, i8** %26
%28 = bitcast i8* %27 to void (i8*, i32, i8**)*
store void (i8*, i32, i8**)* %28, void (i8*, i32, i8**)** %10
%29 = load void (i8*, i32, i8**)*, void (i8*, i32, i8**)** %10
%30 = load i8*, i8** %4
%31 = load i8**, i8*** %6
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %4
%34 = call i32 @strcpy(i8* %18, i8* %33)
store i32 0, i32* %11
br label %35
35: ; preds = %48, %3
%36 = load i32, i32* %11
%37 = icmp slt i32 %36, 10
br i1 %37, label %38, label %51
38: ; preds = %35
%39 = load i32, i32* %11
%40 = or i32 %39, 48
%41 = trunc i32 %40 to i8
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %18, i64 %43
store i8 %41, i8* %44
%45 = load void (i8*, i32, i8**)*, void (i8*, i32, i8**)** %10
%46 = load i8**, i8*** %6
%47 = getelementptr inbounds i8*, i8** %46, i64 1
br label %48
48: ; preds = %38
%49 = load i32, i32* %11
%50 = add nsw i32 %49, 1
store i32 %50, i32* %11
br label %35
51: ; preds = %35
%52 = load i8*, i8** %8
ret void
}

LLVM IR (-O2):
define void @num_ending(i8* %0, i32 %1, i8** %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, 2
%6 = zext i32 %5 to i64
%7 = alloca i8, i64 %6
%8 = sext i32 %4 to i64
%9 = getelementptr inbounds i8, i8* %7, i64 %8
store i8 0, i8* %9
%10 = add nsw i32 %4, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %7, i64 %11
store i8 0, i8* %12
%13 = bitcast i8** %2 to void (i8*, i32, i8**)**
%14 = load void (i8*, i32, i8**)*, void (i8*, i32, i8**)** %13
%15 = getelementptr inbounds i8*, i8** %2, i64 1
tail call void %14(i8* %0, i32 0, i8** %15)
%16 = call i32 @strcpy(i8* %7, i8* %0)
store i8 48, i8* %9
store i8 49, i8* %9
store i8 50, i8* %9
store i8 51, i8* %9
store i8 52, i8* %9
store i8 53, i8* %9
store i8 54, i8* %9
store i8 55, i8* %9
store i8 56, i8* %9
store i8 57, i8* %9
ret void
}