#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*/ generate_password(int);
int /*<<< orphan*/ read_number(char *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main(void) {
  int num_of_passwords;
  int password_length;
  int i;
  read_number("Number of passwords to generate? ", &num_of_passwords);
  read_number("Length of each password? ", &password_length);
  srand(time(0));
  for (i = 0; i < num_of_passwords; ++i)
    generate_password(password_length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <read_number@plt>
lea    0xebc(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <read_number@plt>
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a6 <main+0x66>
mov    -0xc(%rbp),%edi
call   1060 <generate_password@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1184 <main+0x44>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <read_number@plt>
lea    0xec5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <read_number@plt>
xor    %ebx,%ebx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
cmpl   $0x0,0x8(%rsp)
jle    1192 <main+0x52>
xchg   %ax,%ax
mov    0xc(%rsp),%edi
call   1060 <generate_password@plt>
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jl     1180 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Number of passwords to generate? \00"
@.str.1 = [26 x i8] c"Length of each password? \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @read_number(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = call i32 @read_number(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = call i32 @time(i32 0)
%8 = call i32 @srand(i32 %7)
store i32 0, i32* %4
br label %9
9: ; preds = %16, %0
%10 = load i32, i32* %4
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = load i32, i32* %3
%15 = call i32 @generate_password(i32 %14)
br label %16
16: ; preds = %13
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %9
19: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"Number of passwords to generate? \00"
@.str.1 = [26 x i8] c"Length of each password? \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @read_number(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = call i32 @read_number(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 @time(i32 0)
%8 = call i32 @srand(i32 %7)
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %0, %11
%12 = phi i32 [ %15, %11 ], [ 0, %0 ]
%13 = load i32, i32* %2
%14 = call i32 @generate_password(i32 %13)
%15 = add nuw nsw i32 %12, 1
%16 = load i32, i32* %1
%17 = icmp slt i32 %15, %16
br i1 %17, label %11, label %18
18: ; preds = %11, %0
ret i32 0
}