#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*/ init_bounds(char **, int *, int *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void punct_ending(char *pass, int cnt, void **nxt_f) {
  char *endings[] = {"!", "^", "$", "&", "^", "#", "@", "~", "%", "*", NULL};
  static int punct_len = 0, punct_max_add = 0;
  if (punct_len == 0 || punct_max_add == 0)
    init_bounds(endings, &punct_len, &punct_max_add);
  int lpass = strlen(pass);
  char pass_new[lpass + punct_max_add + 1];
  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 < punct_len; i++) {
    strncpy(pass_new + lpass, endings[i], punct_max_add + 1);
    func(pass_new, 0, nxt_f + 1);
  }
}


x86 assembly (clang, -O0):
<punct_ending>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x70(%rbp),%rdi
lea    0x2c4f(%rip),%rsi
mov    $0x58,%edx
call   1060 <memcpy@plt>
cmpl   $0x0,0x2eca(%rip)
je     1195 <punct_ending+0x45>
cmpl   $0x0,0x2ec1(%rip)
jne    11ac <punct_ending+0x5c>
lea    -0x70(%rbp),%rdi
lea    0x2eac(%rip),%rsi
lea    0x2ea9(%rip),%rdx
call   1070 <init_bounds@plt>
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%edx
mov    0x2e8f(%rip),%eax
mov    %eax,%ecx
mov    %edx,%eax
lea    0x1(%rax,%rcx,1),%eax
mov    %rsp,%rcx
mov    %rcx,-0x80(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x88(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
xor    %esi,%esi
call   *%rax
mov    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
movl   $0x0,-0x94(%rbp)
mov    -0x94(%rbp),%eax
cmp    0x2e0f(%rip),%eax
jge    1299 <punct_ending+0x149>
mov    -0xa0(%rbp),%rdi
movslq -0x74(%rbp),%rax
add    %rax,%rdi
movslq -0x94(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rsi
mov    0x2ded(%rip),%edx
add    $0x1,%edx
call   1030 <strncpy@plt>
mov    -0xa0(%rbp),%rdi
mov    -0x90(%rbp),%rax
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
xor    %esi,%esi
call   *%rax
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1231 <punct_ending+0xe1>
mov    -0x80(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<punct_ending>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rdx,%r15
mov    %rdi,%r14
mov    0x2cb2(%rip),%rax
mov    %rax,-0x40(%rbp)
movaps 0x2c97(%rip),%xmm0
movaps %xmm0,-0x50(%rbp)
movaps 0x2c7c(%rip),%xmm0
movaps %xmm0,-0x60(%rbp)
movaps 0x2c61(%rip),%xmm0
movaps %xmm0,-0x70(%rbp)
movaps 0x2c46(%rip),%xmm0
movaps %xmm0,-0x80(%rbp)
movaps 0x2c2b(%rip),%xmm0
movaps %xmm0,-0x90(%rbp)
cmpl   $0x0,0x2ea1(%rip)
je     11ae <punct_ending+0x6e>
cmpl   $0x0,0x2e9c(%rip)
jne    11c8 <punct_ending+0x88>
lea    0x2e8f(%rip),%rsi
lea    0x2e8c(%rip),%rdx
lea    -0x90(%rbp),%rdi
call   1060 <init_bounds@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebx
mov    %rsp,-0x30(%rbp)
mov    0x2e6c(%rip),%eax
add    %ebx,%eax
add    $0x1,%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
mov    (%r15),%r12
add    $0x8,%r15
mov    %r14,%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   *%r12
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
cmpl   $0x0,0x2e2e(%rip)
jle    1254 <punct_ending+0x114>
movslq %ebx,%r14
add    %r13,%r14
xor    %ebx,%ebx
mov    -0x90(%rbp,%rbx,8),%rsi
ff
mov    0x2e1a(%rip),%edx
add    $0x1,%edx
mov    %r14,%rdi
call   1030 <strncpy@plt>
mov    %r13,%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   *%r12
add    $0x1,%rbx
movslq 0x2df5(%rip),%rax
cmp    %rax,%rbx
jl     1220 <punct_ending+0xe0>
mov    -0x30(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"!\00"
@.str.1 = [2 x i8] c"^\00"
@.str.2 = [2 x i8] c"$\00"
@.str.3 = [2 x i8] c"&\00"
@.str.4 = [2 x i8] c"#\00"
@.str.5 = [2 x i8] c"@\00"
@.str.6 = [2 x i8] c"~\00"
@.str.7 = [2 x i8] c"%\00"
@.str.8 = [2 x i8] c"*\00"
@__const.punct_ending.endings = [11 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i32 0, i32 0), i8* null]
@punct_ending.punct_len = internal global i32 0
@punct_ending.punct_max_add = internal global i32 0
define void @punct_ending(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca [11 x i8*]
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca void (i8*, i32, i8**)*
%12 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%13 = bitcast [11 x i8*]* %7 to i8*
%14 = load i32, i32* @punct_ending.punct_len
%15 = icmp eq i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %3
%17 = load i32, i32* @punct_ending.punct_max_add
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16, %3
%20 = getelementptr inbounds [11 x i8*], [11 x i8*]* %7, i64 0, i64 0
%21 = call i32 @init_bounds(i8** %20, i32* @punct_ending.punct_len, i32* @punct_ending.punct_max_add)
br label %22
22: ; preds = %19, %16
%23 = load i8*, i8** %4
%24 = call i32 @strlen(i8* %23)
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = load i32, i32* @punct_ending.punct_max_add
%27 = add nsw i32 %25, %26
%28 = add nsw i32 %27, 1
%29 = zext i32 %28 to i64
%30 = call i8* @llvm.stacksave()
store i8* %30, i8** %9
%31 = alloca i8, i64 %29
store i64 %29, i64* %10
%32 = load i8**, i8*** %6
%33 = load i8*, i8** %32
%34 = bitcast i8* %33 to void (i8*, i32, i8**)*
store void (i8*, i32, i8**)* %34, void (i8*, i32, i8**)** %11
%35 = load void (i8*, i32, i8**)*, void (i8*, i32, i8**)** %11
%36 = load i8*, i8** %4
%37 = load i8**, i8*** %6
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %4
%40 = call i32 @strcpy(i8* %31, i8* %39)
store i32 0, i32* %12
br label %41
41: ; preds = %59, %22
%42 = load i32, i32* %12
%43 = load i32, i32* @punct_ending.punct_len
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %62
45: ; preds = %41
%46 = load i32, i32* %8
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %31, i64 %47
%49 = load i32, i32* %12
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [11 x i8*], [11 x i8*]* %7, i64 0, i64 %50
%52 = load i8*, i8** %51
%53 = load i32, i32* @punct_ending.punct_max_add
%54 = add nsw i32 %53, 1
%55 = call i32 @strncpy(i8* %48, i8* %52, i32 %54)
%56 = load void (i8*, i32, i8**)*, void (i8*, i32, i8**)** %11
%57 = load i8**, i8*** %6
%58 = getelementptr inbounds i8*, i8** %57, i64 1
br label %59
59: ; preds = %45
%60 = load i32, i32* %12
%61 = add nsw i32 %60, 1
store i32 %61, i32* %12
br label %41
62: ; preds = %41
%63 = load i8*, i8** %9
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"!\00"
@.str.1 = [2 x i8] c"^\00"
@.str.2 = [2 x i8] c"$\00"
@.str.3 = [2 x i8] c"&\00"
@.str.4 = [2 x i8] c"#\00"
@.str.5 = [2 x i8] c"@\00"
@.str.6 = [2 x i8] c"~\00"
@.str.7 = [2 x i8] c"%\00"
@.str.8 = [2 x i8] c"*\00"
@__const.punct_ending.endings = [11 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i32 0, i32 0), i8* null]
@punct_ending.punct_len = internal global i32 0
@punct_ending.punct_max_add = internal global i32 0
define void @punct_ending(i8* %0, i32 %1, i8** %2) {
%4 = alloca [11 x i8*]
%5 = bitcast [11 x i8*]* %4 to i8*
%6 = load i32, i32* @punct_ending.punct_len
%7 = icmp eq i32 %6, 0
%8 = load i32, i32* @punct_ending.punct_max_add
%9 = icmp eq i32 %8, 0
%10 = select i1 %7, i1 true, i1 %9
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = getelementptr inbounds [11 x i8*], [11 x i8*]* %4, i64 0, i64 0
%13 = call i32 @init_bounds(i8** %12, i32* @punct_ending.punct_len, i32* @punct_ending.punct_max_add)
br label %14
14: ; preds = %3, %11
%15 = call i32 @strlen(i8* %0)
%16 = load i32, i32* @punct_ending.punct_max_add
%17 = add i32 %15, 1
%18 = add i32 %17, %16
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
%21 = alloca i8, i64 %19
%22 = bitcast i8** %2 to void (i8*, i32, i8**)**
%23 = load void (i8*, i32, i8**)*, void (i8*, i32, i8**)** %22
%24 = getelementptr inbounds i8*, i8** %2, i64 1
%25 = call i32 @strcpy(i8* %21, i8* %0)
%26 = load i32, i32* @punct_ending.punct_len
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %42
28: ; preds = %14
%29 = sext i32 %15 to i64
%30 = getelementptr inbounds i8, i8* %21, i64 %29
br label %31
31: ; preds = %28, %31
%32 = phi i64 [ 0, %28 ], [ %38, %31 ]
%33 = getelementptr inbounds [11 x i8*], [11 x i8*]* %4, i64 0, i64 %32
%34 = load i8*, i8** %33
%35 = load i32, i32* @punct_ending.punct_max_add
%36 = add nsw i32 %35, 1
%37 = call i32 @strncpy(i8* %30, i8* %34, i32 %36)
%38 = add nuw nsw i64 %32, 1
%39 = load i32, i32* @punct_ending.punct_len
%40 = sext i32 %39 to i64
%41 = icmp slt i64 %38, %40
br i1 %41, label %31, label %42
42: ; preds = %31, %14
ret void
}