#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*/ atoi(char *);
int /*<<< orphan*/ brute_force(int, char *);
scalar_t__ one_try(int /*<<< orphan*/, int, char *);
int /*<<< orphan*/ show_usage(char *);
int strlen(char *);
int main(int ac, char **av) {
  int len = 0;
  char *msg = av[1];
  if (msg != NULL)
    len = strlen(msg);
  if (ac == 2)
    brute_force(len, msg);
  else if (ac == 3) {
    if (one_try(atoi(av[2]), len, msg)) {
      show_usage(av[0]);
      return (-1);
    }
  } else
    show_usage(av[0]);
  return (0);
}


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    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1190 <main+0x40>
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11ab <main+0x5b>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <brute_force@plt>
jmp    1208 <main+0xb8>
cmpl   $0x3,-0x8(%rbp)
jne    11f7 <main+0xa7>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1050 <one_try@plt>
cmp    $0x0,%rax
je     11f2 <main+0xa2>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <show_usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    120f <main+0xbf>
jmp    1203 <main+0xb3>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <show_usage@plt>
jmp    1208 <main+0xb8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x8(%rsi),%rbx
test   %rbx,%rbx
je     1187 <main+0x37>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
cmp    $0x3,%ebp
je     118f <main+0x3f>
cmp    $0x2,%ebp
jne    11b9 <main+0x69>
mov    %r15d,%edi
mov    %rbx,%rsi
call   1030 <brute_force@plt>
jmp    11c1 <main+0x71>
xor    %r15d,%r15d
cmp    $0x3,%ebp
jne    1175 <main+0x25>
mov    0x10(%r14),%rdi
call   1070 <atoi@plt>
mov    %eax,%edi
mov    %r15d,%esi
mov    %rbx,%rdx
call   1050 <one_try@plt>
test   %rax,%rax
je     11c1 <main+0x71>
mov    (%r14),%rdi
call   1060 <show_usage@plt>
mov    $0xffffffff,%eax
jmp    11c3 <main+0x73>
mov    (%r14),%rdi
call   1060 <show_usage@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i8*, i8** %7
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %6
br label %16
16: ; preds = %13, %2
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* %6
%21 = load i8*, i8** %7
%22 = call i32 @brute_force(i32 %20, i8* %21)
br label %47
23: ; preds = %16
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 3
br i1 %25, label %26, label %41
26: ; preds = %23
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
%30 = call i32 @atoi(i8* %29)
%31 = load i32, i32* %6
%32 = load i8*, i8** %7
%33 = call i64 @one_try(i32 %30, i32 %31, i8* %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %26
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 0
%38 = load i8*, i8** %37
%39 = call i32 @show_usage(i8* %38)
store i32 -1, i32* %3
br label %48
40: ; preds = %26
br label %46
41: ; preds = %23
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 0
%44 = load i8*, i8** %43
%45 = call i32 @show_usage(i8* %44)
br label %46
46: ; preds = %41, %40
br label %47
47: ; preds = %46, %19
store i32 0, i32* %3
br label %48
48: ; preds = %47, %35
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @strlen(i8* %4)
br label %8
8: ; preds = %6, %2
%9 = phi i32 [ %7, %6 ], [ 0, %2 ]
switch i32 %0, label %21 [
i32 2, label %10
i32 3, label %12
]
10: ; preds = %8
%11 = tail call i32 @brute_force(i32 %9, i8* %4)
br label %24
12: ; preds = %8
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = tail call i64 @one_try(i32 %15, i32 %9, i8* %4)
%17 = icmp eq i64 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %12
%19 = load i8*, i8** %1
%20 = tail call i32 @show_usage(i8* %19)
br label %24
21: ; preds = %8
%22 = load i8*, i8** %1
%23 = tail call i32 @show_usage(i8* %22)
br label %24
24: ; preds = %10, %12, %21, %18
%25 = phi i32 [ -1, %18 ], [ 0, %21 ], [ 0, %12 ], [ 0, %10 ]
ret i32 %25
}