#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*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ RAND_bytes(void *, int);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ check_openssl_result(int /*<<< orphan*/, int, int, char *,
                                        int);
uint8_t tr_rand_buffer(void *buffer, size_t length) {
  assert(buffer != NULL);
  return check_openssl_result(
      (RAND_bytes(buffer, (int)length)), 1, 1,
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/aj-m/dBittorrent/refs/heads/master/include/"
      "libtransmission/crypto-utils-openssl.c",
      404);
}


x86 assembly (clang, -O0):
<tr_rand_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %eax,%esi
call   1030 <RAND_bytes@plt>
mov    %eax,%edi
mov    $0x1,%edx
lea    0xe91(%rip),%rcx
mov    $0x194,%r8d
mov    %edx,%esi
call   1040 <check_openssl_result@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tr_rand_buffer>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <RAND_bytes@plt>
lea    0xea6(%rip),%rcx
mov    %eax,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x194,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <check_openssl_result@plt>

LLVM IR (-O0):
@.str = [172 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/aj-m/dBittorrent/refs/heads/master/include/libtransmission/crypto-utils-openssl.c\00"
define i32 @tr_rand_buffer(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = trunc i64 %10 to i32
%12 = call i32 @RAND_bytes(i8* %9, i32 %11)
%13 = call i32 @check_openssl_result(i32 %12, i32 1, i32 1, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 404)
ret i32 %13
}

LLVM IR (-O2):
@.str = [172 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/aj-m/dBittorrent/refs/heads/master/include/libtransmission/crypto-utils-openssl.c\00"
define i32 @tr_rand_buffer(i8* %0, i64 %1) {
%3 = icmp ne i8* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = trunc i64 %1 to i32
%7 = tail call i32 @RAND_bytes(i8* %0, i32 %6)
%8 = tail call i32 @check_openssl_result(i32 %7, i32 1, i32 1, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i32 404)
ret i32 %8
}