#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 random();
int /*<<< orphan*/ srandom(unsigned int);
scalar_t__ time(int /*<<< orphan*/);
void vncRandomBytes(unsigned char *bytes) {
  int i;
  unsigned int seed = (unsigned int)time(0);
  srandom(seed);
  for (i = 0; i < 16; i++) {
    bytes[i] = (unsigned char)(random() & 255);
  }
}


x86 assembly (clang, -O0):
<vncRandomBytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <srandom@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    1186 <vncRandomBytes+0x56>
mov    $0x0,%al
call   1050 <random@plt>
and    $0xff,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1155 <vncRandomBytes+0x25>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vncRandomBytes>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0x1(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0x2(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0x3(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0x4(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0x5(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0x6(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0x7(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0x8(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0x9(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0xa(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0xb(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0xc(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0xd(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0xe(%rbx)
xor    %eax,%eax
call   1050 <random@plt>
mov    %al,0xf(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @vncRandomBytes(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i64 @time(i32 0)
%6 = trunc i64 %5 to i32
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = call i32 @srandom(i32 %7)
store i32 0, i32* %3
br label %9
9: ; preds = %20, %1
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 16
br i1 %11, label %12, label %23
12: ; preds = %9
%13 = call i32 (...) @random()
%14 = and i32 %13, 255
%15 = trunc i32 %14 to i8
%16 = load i8*, i8** %2
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 %15, i8* %19
br label %20
20: ; preds = %12
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %9
23: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @vncRandomBytes(i8* nocapture writeonly %0) {
%2 = tail call i64 @time(i32 0)
%3 = trunc i64 %2 to i32
%4 = tail call i32 @srandom(i32 %3)
%5 = tail call i32 (...) @random()
%6 = trunc i32 %5 to i8
store i8 %6, i8* %0
%7 = tail call i32 (...) @random()
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %8, i8* %9
%10 = tail call i32 (...) @random()
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %11, i8* %12
%13 = tail call i32 (...) @random()
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %14, i8* %15
%16 = tail call i32 (...) @random()
%17 = trunc i32 %16 to i8
%18 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %17, i8* %18
%19 = tail call i32 (...) @random()
%20 = trunc i32 %19 to i8
%21 = getelementptr inbounds i8, i8* %0, i64 5
store i8 %20, i8* %21
%22 = tail call i32 (...) @random()
%23 = trunc i32 %22 to i8
%24 = getelementptr inbounds i8, i8* %0, i64 6
store i8 %23, i8* %24
%25 = tail call i32 (...) @random()
%26 = trunc i32 %25 to i8
%27 = getelementptr inbounds i8, i8* %0, i64 7
store i8 %26, i8* %27
%28 = tail call i32 (...) @random()
%29 = trunc i32 %28 to i8
%30 = getelementptr inbounds i8, i8* %0, i64 8
store i8 %29, i8* %30
%31 = tail call i32 (...) @random()
%32 = trunc i32 %31 to i8
%33 = getelementptr inbounds i8, i8* %0, i64 9
store i8 %32, i8* %33
%34 = tail call i32 (...) @random()
%35 = trunc i32 %34 to i8
%36 = getelementptr inbounds i8, i8* %0, i64 10
store i8 %35, i8* %36
%37 = tail call i32 (...) @random()
%38 = trunc i32 %37 to i8
%39 = getelementptr inbounds i8, i8* %0, i64 11
store i8 %38, i8* %39
%40 = tail call i32 (...) @random()
%41 = trunc i32 %40 to i8
%42 = getelementptr inbounds i8, i8* %0, i64 12
store i8 %41, i8* %42
%43 = tail call i32 (...) @random()
%44 = trunc i32 %43 to i8
%45 = getelementptr inbounds i8, i8* %0, i64 13
store i8 %44, i8* %45
%46 = tail call i32 (...) @random()
%47 = trunc i32 %46 to i8
%48 = getelementptr inbounds i8, i8* %0, i64 14
store i8 %47, i8* %48
%49 = tail call i32 (...) @random()
%50 = trunc i32 %49 to i8
%51 = getelementptr inbounds i8, i8* %0, i64 15
store i8 %50, i8* %51
ret void
}