#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*/ make_chtable(char *);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ putchar(char);
int rand();
void stdout_password(int digits, int loop, int begin, int end) {
  int rnd;
  int i, j;
  char chtable[95];
  make_chtable(chtable);
  for (i = 0; i < loop; i++) {
    for (j = 0; j < digits; j++) {
      rnd = rand() % (end + 1) + begin;
      printf("%c", chtable[rnd]);
    }
    putchar(' ');
  }
}


x86 assembly (clang, -O0):
<stdout_password>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
call   1050 <make_chtable@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d7 <stdout_password+0x97>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11bf <stdout_password+0x7f>
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
add    -0xc(%rbp),%edx
mov    %edx,-0x14(%rbp)
movslq -0x14(%rbp),%rax
lea    0xe59(%rip),%rdi
movsbl -0x80(%rbp,%rax,1),%esi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117a <stdout_password+0x3a>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1167 <stdout_password+0x27>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdout_password>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %ecx,%ebx
mov    %edx,%ebp
mov    %esi,%r15d
mov    %edi,%r14d
lea    0x10(%rsp),%rdi
call   1050 <make_chtable@plt>
mov    %r15d,0xc(%rsp)
test   %r15d,%r15d
jle    11c4 <stdout_password+0x84>
add    $0x1,%ebx
lea    0xe8a(%rip),%r12
xor    %r13d,%r13d
jmp    1195 <stdout_password+0x55>
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%r13d
cmp    0xc(%rsp),%r13d
je     11c4 <stdout_password+0x84>
test   %r14d,%r14d
jle    1180 <stdout_password+0x40>
mov    %r14d,%r15d
nopl   (%rax)
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebx
add    %ebp,%edx
movslq %edx,%rax
movsbl 0x10(%rsp,%rax,1),%esi
mov    %r12,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%r15d
jne    11a0 <stdout_password+0x60>
jmp    1180 <stdout_password+0x40>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @stdout_password(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [95 x i8]
%6 = getelementptr inbounds [95 x i8], [95 x i8]* %5, i64 0, i64 0
%7 = call i32 @make_chtable(i8* %6)
%8 = icmp sgt i32 %1, 0
br i1 %8, label %9, label %29
9: ; preds = %4
%10 = icmp sgt i32 %0, 0
%11 = add nsw i32 %3, 1
br label %12
12: ; preds = %9, %25
%13 = phi i32 [ 0, %9 ], [ %27, %25 ]
br i1 %10, label %14, label %25
14: ; preds = %12, %14
%15 = phi i32 [ %23, %14 ], [ 0, %12 ]
%16 = call i32 (...) @rand()
%17 = srem i32 %16, %11
%18 = add nsw i32 %17, %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [95 x i8], [95 x i8]* %5, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %21)
%23 = add nuw nsw i32 %15, 1
%24 = icmp eq i32 %23, %0
br i1 %24, label %25, label %14
25: ; preds = %14, %12
%26 = call i32 @putchar(i8 signext 32)
%27 = add nuw nsw i32 %13, 1
%28 = icmp eq i32 %27, %1
br i1 %28, label %29, label %12
29: ; preds = %25, %4
ret void
}