#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 brute(char *string, int index, int length) {
  char cache = '!';
  while (cache <= '~') {
    string[index] = cache;
    if (index < (length - 1))
      brute(string, index + 1, length);
    else {
      string[index + 1] = '\0';
      printf("%s\n", string);
    }
    ++cache;
  }
}


x86 assembly (clang, -O0):
<brute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movb   $0x21,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x7e,%eax
jg     11a7 <brute+0x87>
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1179 <brute+0x59>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <brute@plt>
jmp    119a <brute+0x7a>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rsi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
add    $0x1,%al
mov    %al,-0x11(%rbp)
jmp    1136 <brute+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brute>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rdi,%rbx
movslq %esi,%r13
lea    -0x1(%r14),%ebp
lea    0x1(%r13),%r15
mov    $0x21,%r12b
jmp    116e <brute+0x4e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rbx,%r15,1)
lea    0xea4(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x1,%r12b
cmp    $0x7f,%r12b
je     1187 <brute+0x67>
mov    %r12b,(%rbx,%r13,1)
cmp    %r13d,%ebp
jle    1150 <brute+0x30>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
call   1040 <brute@plt>
jmp    1164 <brute+0x44>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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