#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 atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  srand(time(NULL));
  int total, i, j;
  char *key[] = {"A", "B", "C", "D", "E", "F", "G", "H", "I",
                 "J", "K", "L", "M", "N", "O", "P", "Q", "R",
                 "S", "T", "U", "V", "W", "X", "Y", "Z", " "};
  char str[20];
  strcpy(str, argv[1]);
  total = atoi(str);
  char *output[total + 1];
  for (i = 0; i < total; i++) {
    j = rand() % 27;
    output[i] = key[j];
  }
  output[total] = "\n";
  for (i = 0; i < total + 1; i++) {
    fprintf(stdout, "%s", output[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0x2ba0(%rip),%rsi
lea    -0x100(%rbp),%rdi
mov    $0xd8,%edx
call   1060 <memcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    -0x120(%rbp),%rdi
mov    %rdi,-0x140(%rbp)
call   1030 <strcpy@plt>
mov    -0x140(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x128(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x138(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x130(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    125c <main+0xec>
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0x1b,%ecx
cltd
idiv   %ecx
mov    -0x138(%rbp),%rax
mov    %edx,-0x1c(%rbp)
movslq -0x1c(%rbp),%rcx
mov    -0x100(%rbp,%rcx,8),%rdx
ff
movslq -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1215 <main+0xa5>
mov    -0x138(%rbp),%rax
movslq -0x14(%rbp),%rcx
lea    0xdc8(%rip),%rdx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    12bc <main+0x14c>
mov    -0x138(%rbp),%rax
mov    0x2d48(%rip),%rcx
mov    (%rcx),%edi
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd8f(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1279 <main+0x109>
movl   $0x0,-0x4(%rbp)
mov    -0x128(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    0x8(%rbx),%rsi
lea    -0x50(%rbp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1070 <atoi@plt>
mov    %rsp,-0x38(%rbp)
lea    0x1(%rax),%ecx
mov    %rsp,%r15
mov    %rcx,-0x30(%rbp)
lea    0xf(,%rcx,8),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r15
mov    %r15,%rsp
mov    %rax,%rbx
test   %eax,%eax
jle    120b <main+0xab>
mov    %ebx,%r13d
lea    0xe71(%rip),%r14
xor    %r12d,%r12d
xchg   %ax,%ax
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x4bda12f7,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
cltq
movslq (%r14,%rax,4),%rax
add    %r14,%rax
mov    %rax,(%r15,%r12,8)
add    $0x1,%r12
cmp    %r12,%r13
jne    11d0 <main+0x70>
movslq %ebx,%rax
lea    0xe21(%rip),%rcx
mov    %rcx,(%r15,%rax,8)
test   %ebx,%ebx
mov    -0x30(%rbp),%r13
js     1258 <main+0xf8>
xor    %ebx,%ebx
mov    0x2db6(%rip),%r14
lea    0xe07(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edi
mov    (%r15,%rbx,8),%rdx
mov    %r12,%rsi
call   1050 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1240 <main+0xe0>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"A\00"
@.str.1 = [2 x i8] c"B\00"
@.str.2 = [2 x i8] c"C\00"
@.str.3 = [2 x i8] c"D\00"
@.str.4 = [2 x i8] c"E\00"
@.str.5 = [2 x i8] c"F\00"
@.str.6 = [2 x i8] c"G\00"
@.str.7 = [2 x i8] c"H\00"
@.str.8 = [2 x i8] c"I\00"
@.str.9 = [2 x i8] c"J\00"
@.str.10 = [2 x i8] c"K\00"
@.str.11 = [2 x i8] c"L\00"
@.str.12 = [2 x i8] c"M\00"
@.str.13 = [2 x i8] c"N\00"
@.str.14 = [2 x i8] c"O\00"
@.str.15 = [2 x i8] c"P\00"
@.str.16 = [2 x i8] c"Q\00"
@.str.17 = [2 x i8] c"R\00"
@.str.18 = [2 x i8] c"S\00"
@.str.19 = [2 x i8] c"T\00"
@.str.20 = [2 x i8] c"U\00"
@.str.21 = [2 x i8] c"V\00"
@.str.22 = [2 x i8] c"W\00"
@.str.23 = [2 x i8] c"X\00"
@.str.24 = [2 x i8] c"Y\00"
@.str.25 = [2 x i8] c"Z\00"
@.str.26 = [2 x i8] c" \00"
@__const.main.key = [27 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.26, i32 0, i32 0)]
@.str.27 = [2 x i8] c"\0A\00"
@stdout = global i32 0
@.str.28 = [3 x i8] c"%s\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 [27 x i8*]
%10 = alloca [20 x i8]
%11 = alloca i8*
%12 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i32 @time(i32* null)
%14 = call i32 @srand(i32 %13)
%15 = bitcast [27 x i8*]* %9 to i8*
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @strcpy(i8* %16, i8* %19)
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 1
%25 = zext i32 %24 to i64
%26 = call i8* @llvm.stacksave()
store i8* %26, i8** %11
%27 = alloca i8*, i64 %25
store i64 %25, i64* %12
store i32 0, i32* %7
br label %28
28: ; preds = %42, %2
%29 = load i32, i32* %7
%30 = load i32, i32* %6
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %45
32: ; preds = %28
%33 = call i32 (...) @rand()
%34 = srem i32 %33, 27
store i32 %34, i32* %8
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [27 x i8*], [27 x i8*]* %9, i64 0, i64 %36
%38 = load i8*, i8** %37
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %27, i64 %40
store i8* %38, i8** %41
br label %42
42: ; preds = %32
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %28
45: ; preds = %28
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %27, i64 %47
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.27, i64 0, i64 0), i8** %48
store i32 0, i32* %7
br label %49
49: ; preds = %61, %45
%50 = load i32, i32* %7
%51 = load i32, i32* %6
%52 = add nsw i32 %51, 1
%53 = icmp slt i32 %50, %52
br i1 %53, label %54, label %64
54: ; preds = %49
%55 = load i32, i32* @stdout
%56 = load i32, i32* %7
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %27, i64 %57
%59 = load i8*, i8** %58
%60 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.28, i64 0, i64 0), i8* %59)
br label %61
61: ; preds = %54
%62 = load i32, i32* %7
%63 = add nsw i32 %62, 1
store i32 %63, i32* %7
br label %49
64: ; preds = %49
store i32 0, i32* %3
%65 = load i8*, i8** %11
%66 = load i32, i32* %3
ret i32 %66
}

LLVM IR (-O2):
@.str = [2 x i8] c"A\00"
@.str.1 = [2 x i8] c"B\00"
@.str.2 = [2 x i8] c"C\00"
@.str.3 = [2 x i8] c"D\00"
@.str.4 = [2 x i8] c"E\00"
@.str.5 = [2 x i8] c"F\00"
@.str.6 = [2 x i8] c"G\00"
@.str.7 = [2 x i8] c"H\00"
@.str.8 = [2 x i8] c"I\00"
@.str.9 = [2 x i8] c"J\00"
@.str.10 = [2 x i8] c"K\00"
@.str.11 = [2 x i8] c"L\00"
@.str.12 = [2 x i8] c"M\00"
@.str.13 = [2 x i8] c"N\00"
@.str.14 = [2 x i8] c"O\00"
@.str.15 = [2 x i8] c"P\00"
@.str.16 = [2 x i8] c"Q\00"
@.str.17 = [2 x i8] c"R\00"
@.str.18 = [2 x i8] c"S\00"
@.str.19 = [2 x i8] c"T\00"
@.str.20 = [2 x i8] c"U\00"
@.str.21 = [2 x i8] c"V\00"
@.str.22 = [2 x i8] c"W\00"
@.str.23 = [2 x i8] c"X\00"
@.str.24 = [2 x i8] c"Y\00"
@.str.25 = [2 x i8] c"Z\00"
@.str.26 = [2 x i8] c" \00"
@reltable.main = [27 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.1 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.2 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.3 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.4 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.5 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.6 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.7 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.8 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.9 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.10 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.11 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.12 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.13 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.14 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.15 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.16 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.17 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.18 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.19 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.20 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.21 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.22 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.23 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.24 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.25 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.26 to i64), i64 ptrtoint ([27 x i32]* @reltable.main to i64)) to i32)]
@.str.27 = [2 x i8] c"\0A\00"
@stdout = global i32 0
@.str.28 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [20 x i8]
%4 = tail call i32 @time(i32* null)
%5 = tail call i32 @srand(i32 %4)
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @strcpy(i8* %6, i8* %8)
%10 = call i32 @atoi(i8* %6)
%11 = add i32 %10, 1
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
%14 = alloca i8*, i64 %12
%15 = icmp sgt i32 %10, 0
br i1 %15, label %16, label %28
16: ; preds = %2
%17 = zext i32 %10 to i64
br label %18
18: ; preds = %16, %18
%19 = phi i64 [ 0, %16 ], [ %26, %18 ]
%20 = call i32 (...) @rand()
%21 = srem i32 %20, 27
%22 = sext i32 %21 to i64
%23 = shl i64 %22, 2
%24 = call i8* @llvm.load.relative.i64(i8* bitcast ([27 x i32]* @reltable.main to i8*), i64 %23)
%25 = getelementptr inbounds i8*, i8** %14, i64 %19
store i8* %24, i8** %25
%26 = add nuw nsw i64 %19, 1
%27 = icmp eq i64 %26, %17
br i1 %27, label %28, label %18
28: ; preds = %18, %2
%29 = sext i32 %10 to i64
%30 = getelementptr inbounds i8*, i8** %14, i64 %29
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.27, i64 0, i64 0), i8** %30
%31 = icmp slt i32 %10, 0
br i1 %31, label %40, label %32
32: ; preds = %28, %32
%33 = phi i64 [ %38, %32 ], [ 0, %28 ]
%34 = load i32, i32* @stdout
%35 = getelementptr inbounds i8*, i8** %14, i64 %33
%36 = load i8*, i8** %35
%37 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.28, i64 0, i64 0), i8* %36)
%38 = add nuw nsw i64 %33, 1
%39 = icmp eq i64 %38, %12
br i1 %39, label %40, label %32
40: ; preds = %32, %28
ret i32 0
}