#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*/ RAND_bytes(unsigned char *, int);
int /*<<< orphan*/ RAND_poll();
int /*<<< orphan*/ RAND_seed(unsigned char *, int /*<<< orphan*/);
scalar_t__ RAND_status();
int /*<<< orphan*/ strlen(unsigned char *);
int random_num_gene(unsigned char *seed, unsigned char *random_num,
                    int random_len) {
  do {
  } while (0);
  RAND_seed(seed, strlen(seed));
  while (1) {
    if (RAND_status()) {
      break;
    } else {
      RAND_poll();
    }
  }
  RAND_bytes(random_num, random_len);
  return 0;
}


x86 assembly (clang, -O0):
<random_num_gene>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
jmp    1168 <random_num_gene+0x18>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1040 <RAND_seed@plt>
mov    $0x0,%al
call   1030 <RAND_status@plt>
cmp    $0x0,%rax
je     119a <random_num_gene+0x4a>
jmp    11a6 <random_num_gene+0x56>
mov    $0x0,%al
call   1070 <RAND_poll@plt>
jmp    1184 <random_num_gene+0x34>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <RAND_bytes@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_num_gene>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1050 <strlen@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1040 <RAND_seed@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <RAND_status@plt>
test   %rax,%rax
jne    1185 <random_num_gene+0x35>
xor    %eax,%eax
call   1070 <RAND_poll@plt>
jmp    1170 <random_num_gene+0x20>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1060 <RAND_bytes@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @random_num_gene(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
br label %7
7: ; preds = %3
br label %8
8: ; preds = %7
%9 = load i8*, i8** %4
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @RAND_seed(i8* %9, i32 %11)
br label %13
13: ; preds = %8, %19
%14 = call i64 (...) @RAND_status()
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
br label %20
17: ; preds = %13
%18 = call i32 (...) @RAND_poll()
br label %19
19: ; preds = %17
br label %13
20: ; preds = %16
%21 = load i8*, i8** %5
%22 = load i32, i32* %6
%23 = call i32 @RAND_bytes(i8* %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
define i32 @random_num_gene(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @RAND_seed(i8* %0, i32 %4)
%6 = tail call i64 (...) @RAND_status()
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %3, %8
%9 = tail call i32 (...) @RAND_poll()
%10 = tail call i64 (...) @RAND_status()
%11 = icmp eq i64 %10, 0
br i1 %11, label %8, label %12
12: ; preds = %8, %3
%13 = tail call i32 @RAND_bytes(i8* %1, i32 %2)
ret i32 0
}