#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*/ Brute(int /*<<< orphan*/, char *, int);
int EXIT_SUCCESS;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int strlen(char *);
int main(int argc, char *argv[]) {
  int n;
  for (n = 0; n < argc; ++n)
    if (argc != 3) {
      fprintf(stderr,
              "Usage: %s <alphabet> <k> > out   \n"
              "It generates all combinations, line by line, for \n"
              "an inputed alphabet and specific k size.         \n",
              argv[0]);
      return EXIT_SUCCESS;
    }
  int size = strlen(argv[argc - 2]);
  Brute(atoi(argv[argc - 1]), argv[argc - 2], size);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b3 <main+0x73>
cmpl   $0x3,-0x8(%rbp)
je     11a0 <main+0x60>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe76(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1209 <main+0xc9>
jmp    11a5 <main+0x65>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x1d>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x18(%rbp),%edx
call   1040 <Brute@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
test   %edi,%edi
jle    116a <main+0x2a>
cmp    $0x3,%edi
je     116a <main+0x2a>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe9d(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1193 <main+0x53>
movslq %edi,%rbp
mov    -0x10(%rbx,%rbp,8),%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
mov    -0x8(%rbx,%rbp,8),%rdi
call   1060 <atoi@plt>
mov    -0x10(%rbx,%rbp,8),%rsi
mov    %eax,%edi
mov    %r14d,%edx
call   1040 <Brute@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [135 x i8] c"Usage: %s <alphabet> <k> > out \0AIt generates all combinations, line by line, for \0Aan inputed alphabet and specific k size. \0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %8
8: ; preds = %23, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %26
12: ; preds = %8
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @EXIT_SUCCESS
store i32 %21, i32* %3
br label %50
22: ; preds = %12
br label %23
23: ; preds = %22
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %8
26: ; preds = %8
%27 = load i8**, i8*** %5
%28 = load i32, i32* %4
%29 = sub nsw i32 %28, 2
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %27, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @strlen(i8* %32)
store i32 %33, i32* %7
%34 = load i8**, i8*** %5
%35 = load i32, i32* %4
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %34, i64 %37
%39 = load i8*, i8** %38
%40 = call i32 @atoi(i8* %39)
%41 = load i8**, i8*** %5
%42 = load i32, i32* %4
%43 = sub nsw i32 %42, 2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %41, i64 %44
%46 = load i8*, i8** %45
%47 = load i32, i32* %7
%48 = call i32 @Brute(i32 %40, i8* %46, i32 %47)
%49 = load i32, i32* @EXIT_SUCCESS
store i32 %49, i32* %3
br label %50
50: ; preds = %26, %15
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [135 x i8] c"Usage: %s <alphabet> <k> > out \0AIt generates all combinations, line by line, for \0Aan inputed alphabet and specific k size. \0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 1
%4 = icmp eq i32 %0, 3
%5 = or i1 %3, %4
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %23
10: ; preds = %2
%11 = add nsw i32 %0, -2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @strlen(i8* %14)
%16 = add nsw i32 %0, -1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %1, i64 %17
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = load i8*, i8** %13
%22 = tail call i32 @Brute(i32 %20, i8* %21, i32 %15)
br label %23
23: ; preds = %10, %6
%24 = load i32, i32* @EXIT_SUCCESS
ret i32 %24
}