#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*/ rdrand_long(unsigned long *);
scalar_t__ rdrand_seed();
int main() {
  printf("[.] seed initialized = %s\n", rdrand_seed() ? "OK" : "FAIL");
  int i;
  for (i = 0; i < 16; i++) {
    unsigned long tmp;
    rdrand_long(&tmp);
    printf("[ ] 0x%0"
           "16"
           "lx\n",
           tmp);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <rdrand_seed@plt>
mov    %rax,%rcx
lea    0xece(%rip),%rsi
lea    0xec4(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jge    11a7 <main+0x77>
lea    -0x10(%rbp),%rdi
call   1040 <rdrand_long@plt>
mov    -0x10(%rbp),%rsi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1174 <main+0x44>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <rdrand_seed@plt>
test   %rax,%rax
lea    0xed9(%rip),%rax
lea    0xecf(%rip),%rsi
cmove  %rax,%rsi
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
lea    0xeaf(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <rdrand_long@plt>
mov    (%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [27 x i8] c"[.] seed initialized = %s\0A\00"
@.str.1 = [3 x i8] c"OK\00"
@.str.2 = [5 x i8] c"FAIL\00"
@.str.3 = [14 x i8] c"[ ] 0x%016lx\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
store i32 0, i32* %1
%4 = call i64 (...) @rdrand_seed()
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %7)
store i32 0, i32* %2
br label %9
9: ; preds = %16, %0
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 16
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = call i32 @rdrand_long(i64* %3)
%14 = load i64, i64* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %14)
br label %16
16: ; preds = %12
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %9
19: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"[.] seed initialized = %s\0A\00"
@.str.1 = [3 x i8] c"OK\00"
@.str.2 = [5 x i8] c"FAIL\00"
@.str.3 = [14 x i8] c"[ ] 0x%016lx\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = tail call i64 (...) @rdrand_seed()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = bitcast i64* %1 to i8*
%7 = call i32 @rdrand_long(i64* %1)
%8 = load i64, i64* %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %8)
%10 = call i32 @rdrand_long(i64* %1)
%11 = load i64, i64* %1
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %11)
%13 = call i32 @rdrand_long(i64* %1)
%14 = load i64, i64* %1
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %14)
%16 = call i32 @rdrand_long(i64* %1)
%17 = load i64, i64* %1
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %17)
%19 = call i32 @rdrand_long(i64* %1)
%20 = load i64, i64* %1
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %20)
%22 = call i32 @rdrand_long(i64* %1)
%23 = load i64, i64* %1
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %23)
%25 = call i32 @rdrand_long(i64* %1)
%26 = load i64, i64* %1
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %26)
%28 = call i32 @rdrand_long(i64* %1)
%29 = load i64, i64* %1
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %29)
%31 = call i32 @rdrand_long(i64* %1)
%32 = load i64, i64* %1
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %32)
%34 = call i32 @rdrand_long(i64* %1)
%35 = load i64, i64* %1
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %35)
%37 = call i32 @rdrand_long(i64* %1)
%38 = load i64, i64* %1
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %38)
%40 = call i32 @rdrand_long(i64* %1)
%41 = load i64, i64* %1
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %41)
%43 = call i32 @rdrand_long(i64* %1)
%44 = load i64, i64* %1
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %44)
%46 = call i32 @rdrand_long(i64* %1)
%47 = load i64, i64* %1
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %47)
%49 = call i32 @rdrand_long(i64* %1)
%50 = load i64, i64* %1
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %50)
%52 = call i32 @rdrand_long(i64* %1)
%53 = load i64, i64* %1
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i64 %53)
ret i32 0
}