#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*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void makekey(int n_bytes) {
  char key[n_bytes];
  srand(time(NULL));
  int i;
  for (i = 0; i < n_bytes; i++) {
    key[i] = rand() % 126 + 33;
  }
  i = 0;
  printf("Key: ");
  while (i < n_bytes) {
    printf("%c", key[i++]);
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<makekey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11cf <makekey+0x7f>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x7e,%ecx
cltd
idiv   %ecx
mov    -0x28(%rbp),%rax
add    $0x21,%edx
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1198 <makekey+0x48>
movl   $0x0,-0x1c(%rbp)
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1219 <makekey+0xc9>
mov    -0x28(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e4 <makekey+0x94>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makekey>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%r14d
mov    %edi,%r15d
mov    %rsp,%r12
lea    0xf(%r15),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
test   %r14d,%r14d
jle    1205 <makekey+0xb5>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0xffffffff82082083,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x6,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x7,%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %ecx,%esi
add    %eax,%esi
add    $0x21,%sil
mov    %sil,(%r12,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1190 <makekey+0x40>
lea    0xe2b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14d,%r14d
jle    1213 <makekey+0xc3>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%r12,%rbx,1),%edi
add    $0x1,%rbx
call   1030 <putchar@plt>
cmp    %rbx,%r15
jne    11f0 <makekey+0xa0>
jmp    1213 <makekey+0xc3>
lea    0xdf4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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