#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 */
char *malloc(int);
int rand();
void create_passwd(char **passwds) {
  char j, i = j = 0;
  passwds[i++] = "default";
  for (; i < 100;) {
    passwds[i] = malloc(12);
    for (; j < 11;) {
      passwds[i][j++] = 'A' + (rand() % 20);
    }
    passwds[i++][j++] = 0;
    j %= 12;
  }
  passwds[j++] = "tluafed";
}


x86 assembly (clang, -O0):
<create_passwd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
movb   $0x0,-0xa(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xa(%rbp),%cl
mov    %cl,%dl
add    $0x1,%dl
mov    %dl,-0xa(%rbp)
movsbq %cl,%rcx
lea    0xeb2(%rip),%rdx
mov    %rdx,(%rax,%rcx,8)
movsbl -0xa(%rbp),%eax
cmp    $0x64,%eax
jge    11ff <create_passwd+0xdf>
mov    $0xc,%edi
call   1030 <malloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movsbq -0xa(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movsbl -0x9(%rbp),%eax
cmp    $0xb,%eax
jge    11bf <create_passwd+0x9f>
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
add    $0x41,%edx
mov    -0x8(%rbp),%rax
movsbq -0xa(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x9(%rbp),%cl
mov    %cl,%sil
add    $0x1,%sil
mov    %sil,-0x9(%rbp)
movsbq %cl,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1179 <create_passwd+0x59>
mov    -0x8(%rbp),%rax
mov    -0xa(%rbp),%cl
mov    %cl,%dl
add    $0x1,%dl
mov    %dl,-0xa(%rbp)
movsbq %cl,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x9(%rbp),%cl
mov    %cl,%dl
add    $0x1,%dl
mov    %dl,-0x9(%rbp)
movsbq %cl,%rcx
movb   $0x0,(%rax,%rcx,1)
movsbl -0x9(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x9(%rbp)
jmp    1152 <create_passwd+0x32>
mov    -0x8(%rbp),%rax
mov    -0x9(%rbp),%cl
mov    %cl,%dl
add    $0x1,%dl
mov    %dl,-0x9(%rbp)
movsbq %cl,%rcx
lea    0xdef(%rip),%rdx
mov    %rdx,(%rax,%rcx,8)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_passwd>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xed2(%rip),%rax
mov    %rax,(%rdi)
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0xc,%edi
call   1030 <malloc@plt>
mov    %rax,(%r14,%rbx,8)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x41,%al
mov    (%r14,%rbx,8),%rcx
mov    %al,(%rcx)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x41,%al
mov    (%r14,%rbx,8),%rcx
mov    %al,0x1(%rcx)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x41,%al
mov    (%r14,%rbx,8),%rcx
mov    %al,0x2(%rcx)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x41,%al
mov    (%r14,%rbx,8),%rcx
mov    %al,0x3(%rcx)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x41,%al
mov    (%r14,%rbx,8),%rcx
mov    %al,0x4(%rcx)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x41,%al
mov    (%r14,%rbx,8),%rcx
mov    %al,0x5(%rcx)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x41,%al
mov    (%r14,%rbx,8),%rcx
mov    %al,0x6(%rcx)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x41,%al
mov    (%r14,%rbx,8),%rcx
mov    %al,0x7(%rcx)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x41,%al
mov    (%r14,%rbx,8),%rcx
mov    %al,0x8(%rcx)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x41,%al
mov    (%r14,%rbx,8),%rcx
mov    %al,0x9(%rcx)
xor    %eax,%eax
call   1040 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x41,%al
mov    (%r14,%rbx,8),%rcx
mov    %al,0xa(%rcx)
mov    (%r14,%rbx,8),%rax
add    $0x1,%rbx
movb   $0x0,0xb(%rax)
cmp    $0x64,%rbx
jne    1140 <create_passwd+0x20>
lea    0xca4(%rip),%rax
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"default\00"
@.str.1 = [8 x i8] c"tluafed\00"
define void @create_passwd(i8** %0) {
%2 = alloca i8**
%3 = alloca i8
%4 = alloca i8
store i8** %0, i8*** %2
store i8 0, i8* %3
store i8 0, i8* %4
%5 = load i8**, i8*** %2
%6 = load i8, i8* %4
%7 = add i8 %6, 1
store i8 %7, i8* %4
%8 = sext i8 %6 to i64
%9 = getelementptr inbounds i8*, i8** %5, i64 %8
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %9
br label %10
10: ; preds = %38, %1
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = icmp slt i32 %12, 100
br i1 %13, label %14, label %53
14: ; preds = %10
%15 = call i8* @malloc(i32 12)
%16 = load i8**, i8*** %2
%17 = load i8, i8* %4
%18 = sext i8 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
store i8* %15, i8** %19
br label %20
20: ; preds = %24, %14
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp slt i32 %22, 11
br i1 %23, label %24, label %38
24: ; preds = %20
%25 = call i32 (...) @rand()
%26 = srem i32 %25, 20
%27 = add nsw i32 65, %26
%28 = trunc i32 %27 to i8
%29 = load i8**, i8*** %2
%30 = load i8, i8* %4
%31 = sext i8 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = load i8, i8* %3
%35 = add i8 %34, 1
store i8 %35, i8* %3
%36 = sext i8 %34 to i64
%37 = getelementptr inbounds i8, i8* %33, i64 %36
store i8 %28, i8* %37
br label %20
38: ; preds = %20
%39 = load i8**, i8*** %2
%40 = load i8, i8* %4
%41 = add i8 %40, 1
store i8 %41, i8* %4
%42 = sext i8 %40 to i64
%43 = getelementptr inbounds i8*, i8** %39, i64 %42
%44 = load i8*, i8** %43
%45 = load i8, i8* %3
%46 = add i8 %45, 1
store i8 %46, i8* %3
%47 = sext i8 %45 to i64
%48 = getelementptr inbounds i8, i8* %44, i64 %47
store i8 0, i8* %48
%49 = load i8, i8* %3
%50 = sext i8 %49 to i32
%51 = srem i32 %50, 12
%52 = trunc i32 %51 to i8
store i8 %52, i8* %3
br label %10
53: ; preds = %10
%54 = load i8**, i8*** %2
%55 = load i8, i8* %3
%56 = add i8 %55, 1
store i8 %56, i8* %3
%57 = sext i8 %55 to i64
%58 = getelementptr inbounds i8*, i8** %54, i64 %57
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %58
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"default\00"
@.str.1 = [8 x i8] c"tluafed\00"
define void @create_passwd(i8** nocapture %0) {
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %0
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 1, %1 ], [ %72, %2 ]
%4 = tail call dereferenceable_or_null(12) i8* @malloc(i32 12)
%5 = getelementptr inbounds i8*, i8** %0, i64 %3
store i8* %4, i8** %5
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 20
%8 = trunc i32 %7 to i8
%9 = add nsw i8 %8, 65
%10 = load i8*, i8** %5
store i8 %9, i8* %10
%11 = tail call i32 (...) @rand()
%12 = srem i32 %11, 20
%13 = trunc i32 %12 to i8
%14 = add nsw i8 %13, 65
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
%17 = tail call i32 (...) @rand()
%18 = srem i32 %17, 20
%19 = trunc i32 %18 to i8
%20 = add nsw i8 %19, 65
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i64 2
store i8 %20, i8* %22
%23 = tail call i32 (...) @rand()
%24 = srem i32 %23, 20
%25 = trunc i32 %24 to i8
%26 = add nsw i8 %25, 65
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i64 3
store i8 %26, i8* %28
%29 = tail call i32 (...) @rand()
%30 = srem i32 %29, 20
%31 = trunc i32 %30 to i8
%32 = add nsw i8 %31, 65
%33 = load i8*, i8** %5
%34 = getelementptr inbounds i8, i8* %33, i64 4
store i8 %32, i8* %34
%35 = tail call i32 (...) @rand()
%36 = srem i32 %35, 20
%37 = trunc i32 %36 to i8
%38 = add nsw i8 %37, 65
%39 = load i8*, i8** %5
%40 = getelementptr inbounds i8, i8* %39, i64 5
store i8 %38, i8* %40
%41 = tail call i32 (...) @rand()
%42 = srem i32 %41, 20
%43 = trunc i32 %42 to i8
%44 = add nsw i8 %43, 65
%45 = load i8*, i8** %5
%46 = getelementptr inbounds i8, i8* %45, i64 6
store i8 %44, i8* %46
%47 = tail call i32 (...) @rand()
%48 = srem i32 %47, 20
%49 = trunc i32 %48 to i8
%50 = add nsw i8 %49, 65
%51 = load i8*, i8** %5
%52 = getelementptr inbounds i8, i8* %51, i64 7
store i8 %50, i8* %52
%53 = tail call i32 (...) @rand()
%54 = srem i32 %53, 20
%55 = trunc i32 %54 to i8
%56 = add nsw i8 %55, 65
%57 = load i8*, i8** %5
%58 = getelementptr inbounds i8, i8* %57, i64 8
store i8 %56, i8* %58
%59 = tail call i32 (...) @rand()
%60 = srem i32 %59, 20
%61 = trunc i32 %60 to i8
%62 = add nsw i8 %61, 65
%63 = load i8*, i8** %5
%64 = getelementptr inbounds i8, i8* %63, i64 9
store i8 %62, i8* %64
%65 = tail call i32 (...) @rand()
%66 = srem i32 %65, 20
%67 = trunc i32 %66 to i8
%68 = add nsw i8 %67, 65
%69 = load i8*, i8** %5
%70 = getelementptr inbounds i8, i8* %69, i64 10
store i8 %68, i8* %70
%71 = load i8*, i8** %5
%72 = add nuw nsw i64 %3, 1
%73 = getelementptr inbounds i8, i8* %71, i64 11
store i8 0, i8* %73
%74 = icmp eq i64 %72, 100
br i1 %74, label %75, label %2
75: ; preds = %2
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %0
ret void
}