#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*/ exit(int);
int /*<<< orphan*/ intro();
int parameter(char *);
int /*<<< orphan*/ passgen(int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argv, char *argc[]) {
  int num = 20;
  int length = 12;
  int strength = 4;
  int idx;
  int error;
  if (argv > 1) {
    for (idx = 1; idx < argv; idx++) {
      if (argc[idx][0] == '-') {
        switch (argc[idx][1]) {
        case 's':
          strength = parameter(argc[idx]);
          break;
        case 'n':
          num = parameter(argc[idx]);
          break;
        case 'l':
          length = parameter(argc[idx]);
          break;
        default:
          strength = -1;
          break;
        }
      } else {
        error = 1;
      }
    }
    if (error == 1 || strength == -1 || num == -1 || length == -1) {
      printf("There was an error processing your parameters\n");
      printf("Valid input is:\n");
      printf("\t-n=<number of passwords>\n");
      printf("\t-l=<length of password>\n");
      printf("\t-s=<strength 1 being weakest and 4 being strongest>\n");
      exit(1);
    }
  }
  intro();
  printf("NUM: %d", num);
  printf(" LENGTH: %d", length);
  printf(" STRENGTH %d\n", strength);
  passgen(num, length, strength);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x14,-0x14(%rbp)
movl   $0xc,-0x18(%rbp)
movl   $0x4,-0x1c(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    12e1 <main+0x191>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1264 <main+0x114>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    124a <main+0xfa>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0x28(%rbp)
sub    $0x6c,%eax
je     1225 <main+0xd5>
jmp    11d1 <main+0x81>
mov    -0x28(%rbp),%eax
sub    $0x6e,%eax
je     120c <main+0xbc>
jmp    11e2 <main+0x92>
mov    -0x28(%rbp),%eax
sub    $0x73,%eax
jne    123e <main+0xee>
jmp    11f3 <main+0xa3>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <parameter@plt>
mov    %eax,-0x1c(%rbp)
jmp    1245 <main+0xf5>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <parameter@plt>
mov    %eax,-0x14(%rbp)
jmp    1245 <main+0xf5>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <parameter@plt>
mov    %eax,-0x18(%rbp)
jmp    1245 <main+0xf5>
movl   $0xffffffff,-0x1c(%rbp)
jmp    1251 <main+0x101>
movl   $0x1,-0x24(%rbp)
jmp    1256 <main+0x106>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    118c <main+0x3c>
cmpl   $0x1,-0x24(%rbp)
je     128c <main+0x13c>
cmpl   $0xffffffff,-0x1c(%rbp)
je     128c <main+0x13c>
cmpl   $0xffffffff,-0x14(%rbp)
je     128c <main+0x13c>
cmpl   $0xffffffff,-0x18(%rbp)
jne    12dc <main+0x18c>
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    12e1 <main+0x191>
mov    $0x0,%al
call   1030 <intro@plt>
mov    -0x14(%rbp),%esi
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1060 <passgen@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jge    11cd <main+0x6d>
xor    %eax,%eax
call   1030 <intro@plt>
lea    0xe86(%rip),%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe7b(%rip),%rdi
mov    $0xc,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe74(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x14,%edi
mov    $0xc,%esi
mov    $0x4,%edx
call   1070 <passgen@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%r15
mov    %edi,%r14d
mov    $0x1,%ebx
mov    $0x85,%ebp
jmp    11e9 <main+0x89>
nop
add    $0x1,%rbx
cmp    %rbx,%r14
je     120a <main+0xaa>
mov    (%r15,%rbx,8),%rdi
cmpb   $0x2d,(%rdi)
jne    11e0 <main+0x80>
movsbl 0x1(%rdi),%eax
add    $0xffffff94,%eax
cmp    $0x7,%eax
ja     11e0 <main+0x80>
bt     %eax,%ebp
jae    11e0 <main+0x80>
call   1050 <parameter@plt>
jmp    11e0 <main+0x80>
lea    0xe11(%rip),%rdi
call   1040 <puts@plt>
lea    0xe33(%rip),%rdi
call   1040 <puts@plt>
lea    0xe37(%rip),%rdi
call   1040 <puts@plt>
lea    0xe45(%rip),%rdi
call   1040 <puts@plt>
lea    0xe52(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"There was an error processing your parameters\0A\00"
@.str.1 = [17 x i8] c"Valid input is:\0A\00"
@.str.2 = [27 x i8] c"\09-n=<number of passwords>\0A\00"
@.str.3 = [26 x i8] c"\09-l=<length of password>\0A\00"
@.str.4 = [54 x i8] c"\09-s=<strength 1 being weakest and 4 being strongest>\0A\00"
@.str.5 = [8 x i8] c"NUM: %d\00"
@.str.6 = [12 x i8] c" LENGTH: %d\00"
@.str.7 = [14 x i8] c" STRENGTH %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 20, i32* %6
store i32 12, i32* %7
store i32 4, i32* %8
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %85
13: ; preds = %2
store i32 1, i32* %9
br label %14
14: ; preds = %62, %13
%15 = load i32, i32* %9
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %65
18: ; preds = %14
%19 = load i8**, i8*** %5
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 45
br i1 %27, label %28, label %60
28: ; preds = %18
%29 = load i8**, i8*** %5
%30 = load i32, i32* %9
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
switch i32 %36, label %58 [
i32 115, label %37
i32 110, label %44
i32 108, label %51
]
37: ; preds = %28
%38 = load i8**, i8*** %5
%39 = load i32, i32* %9
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = call i32 @parameter(i8* %42)
store i32 %43, i32* %8
br label %59
44: ; preds = %28
%45 = load i8**, i8*** %5
%46 = load i32, i32* %9
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @parameter(i8* %49)
store i32 %50, i32* %6
br label %59
51: ; preds = %28
%52 = load i8**, i8*** %5
%53 = load i32, i32* %9
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %52, i64 %54
%56 = load i8*, i8** %55
%57 = call i32 @parameter(i8* %56)
store i32 %57, i32* %7
br label %59
58: ; preds = %28
store i32 -1, i32* %8
br label %59
59: ; preds = %58, %51, %44, %37
br label %61
60: ; preds = %18
store i32 1, i32* %10
br label %61
61: ; preds = %60, %59
br label %62
62: ; preds = %61
%63 = load i32, i32* %9
%64 = add nsw i32 %63, 1
store i32 %64, i32* %9
br label %14
65: ; preds = %14
%66 = load i32, i32* %10
%67 = icmp eq i32 %66, 1
br i1 %67, label %77, label %68
68: ; preds = %65
%69 = load i32, i32* %8
%70 = icmp eq i32 %69, -1
br i1 %70, label %77, label %71
71: ; preds = %68
%72 = load i32, i32* %6
%73 = icmp eq i32 %72, -1
br i1 %73, label %77, label %74
74: ; preds = %71
%75 = load i32, i32* %7
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %84
77: ; preds = %74, %71, %68, %65
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %74
br label %85
85: ; preds = %84, %2
%86 = call i32 (...) @intro()
%87 = load i32, i32* %6
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %87)
%89 = load i32, i32* %7
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %89)
%91 = load i32, i32* %8
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %91)
%93 = load i32, i32* %6
%94 = load i32, i32* %7
%95 = load i32, i32* %8
%96 = call i32 @passgen(i32 %93, i32 %94, i32 %95)
ret i32 0
}

LLVM IR (-O2):
@.str.5 = [8 x i8] c"NUM: %d\00"
@.str.6 = [12 x i8] c" LENGTH: %d\00"
@.str.7 = [14 x i8] c" STRENGTH %d\0A\00"
@str = [46 x i8] c"There was an error processing your parameters\00"
@str.8 = [16 x i8] c"Valid input is:\00"
@str.9 = [26 x i8] c"\09-n=<number of passwords>\00"
@str.10 = [25 x i8] c"\09-l=<length of password>\00"
@str.11 = [53 x i8] c"\09-s=<strength 1 being weakest and 4 being strongest>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %28
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %18
%7 = phi i64 [ 1, %4 ], [ %19, %18 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 45
br i1 %11, label %12, label %18
12: ; preds = %6
%13 = getelementptr inbounds i8, i8* %9, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
switch i32 %15, label %18 [
i32 115, label %16
i32 110, label %16
i32 108, label %16
]
16: ; preds = %12, %12, %12
%17 = tail call i32 @parameter(i8* %9)
br label %18
18: ; preds = %16, %6, %12
%19 = add nuw nsw i64 %7, 1
%20 = icmp eq i64 %19, %5
br i1 %20, label %21, label %6
21: ; preds = %18
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.8, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0))
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.10, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.11, i64 0, i64 0))
%27 = tail call i32 @exit(i32 1)
unreachable
28: ; preds = %2
%29 = tail call i32 (...) @intro()
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 20)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 12)
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 4)
%33 = tail call i32 @passgen(i32 20, i32 12, i32 4)
ret i32 0
}