#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 */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ KeyCheck(int /*<<< orphan*/ *);
int /*<<< orphan*/ rand();
void MakeKey(uint16_t *key) {
  do {
    key[0] = rand();
    key[1] = rand();
    key[2] = rand();
    key[3] = rand();
    key[4] = rand();
    key[5] = rand();
    key[6] = rand();
    key[7] = rand();
  } while (!KeyCheck((uint64_t *)key));
}


x86 assembly (clang, -O0):
<MakeKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x1c(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <KeyCheck@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    112c <MakeKey+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MakeKey>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,0x4(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,0x8(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,0xc(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,0x10(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,0x14(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,0x18(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,0x1c(%rbx)
mov    %rbx,%rdi
call   1040 <KeyCheck@plt>
test   %eax,%eax
je     1130 <MakeKey+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @MakeKey(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
br label %3
3: ; preds = %28, %1
%4 = call i32 (...) @rand()
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 0
store i32 %4, i32* %6
%7 = call i32 (...) @rand()
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 1
store i32 %7, i32* %9
%10 = call i32 (...) @rand()
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 2
store i32 %10, i32* %12
%13 = call i32 (...) @rand()
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 3
store i32 %13, i32* %15
%16 = call i32 (...) @rand()
%17 = load i32*, i32** %2
%18 = getelementptr inbounds i32, i32* %17, i64 4
store i32 %16, i32* %18
%19 = call i32 (...) @rand()
%20 = load i32*, i32** %2
%21 = getelementptr inbounds i32, i32* %20, i64 5
store i32 %19, i32* %21
%22 = call i32 (...) @rand()
%23 = load i32*, i32** %2
%24 = getelementptr inbounds i32, i32* %23, i64 6
store i32 %22, i32* %24
%25 = call i32 (...) @rand()
%26 = load i32*, i32** %2
%27 = getelementptr inbounds i32, i32* %26, i64 7
store i32 %25, i32* %27
br label %28
28: ; preds = %3
%29 = load i32*, i32** %2
%30 = call i32 @KeyCheck(i32* %29)
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
br i1 %32, label %3, label %33
33: ; preds = %28
ret void
}

LLVM IR (-O2):
define void @MakeKey(i32* %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = getelementptr inbounds i32, i32* %0, i64 2
%4 = getelementptr inbounds i32, i32* %0, i64 3
%5 = getelementptr inbounds i32, i32* %0, i64 4
%6 = getelementptr inbounds i32, i32* %0, i64 5
%7 = getelementptr inbounds i32, i32* %0, i64 6
%8 = getelementptr inbounds i32, i32* %0, i64 7
br label %9
9: ; preds = %9, %1
%10 = tail call i32 (...) @rand()
store i32 %10, i32* %0
%11 = tail call i32 (...) @rand()
store i32 %11, i32* %2
%12 = tail call i32 (...) @rand()
store i32 %12, i32* %3
%13 = tail call i32 (...) @rand()
store i32 %13, i32* %4
%14 = tail call i32 (...) @rand()
store i32 %14, i32* %5
%15 = tail call i32 (...) @rand()
store i32 %15, i32* %6
%16 = tail call i32 (...) @rand()
store i32 %16, i32* %7
%17 = tail call i32 (...) @rand()
store i32 %17, i32* %8
%18 = tail call i32 @KeyCheck(i32* %0)
%19 = icmp eq i32 %18, 0
br i1 %19, label %9, label %20
20: ; preds = %9
ret void
}