// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]spiped/liball/../libcperciva/crypto/crypto_entropy.c
// Function: crypto_entropy_read
int
crypto_entropy_read(uint8_t * buf, size_t buflen)
{
	size_t bytes_to_provide;

	/* Instantiate if needed. */
	if (instantiated == 0) {
		/* Try to instantiate the PRNG. */
		if (instantiate())
			return (-1);

		/* We have instantiated the PRNG. */
		instantiated = 1;
	}

	/* Loop until we've filled the buffer. */
	while (buflen > 0) {
		/* Do we need to reseed? */
		if (drbg.reseed_counter > RESEED_INTERVAL) {
			if (reseed())
				return (-1);
		}

		/* How much data are we generating in this step? */
		if (buflen > GENERATE_MAXLEN)
			bytes_to_provide = GENERATE_MAXLEN;
		else
			bytes_to_provide = buflen;

		/* Generate bytes. */
		generate(buf, bytes_to_provide);

		/* We've done part of the buffer. */
		buf += bytes_to_provide;
		buflen -= bytes_to_provide;
	}

	/* Success! */
	return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x0, 0xb9f1(%rip)      # 0x15694
jne 0x9d4c
leaq 0x10(%rsp), %rdi
movl $0x30, %esi
callq 0xb773
testl %eax, %eax
je 0x9cc6
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x9ebf
movq %rbx, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0xb9d5(%rip)     # 0x156a8
movups %xmm0, 0xb9be(%rip)     # 0x15698
movaps 0x61cf(%rip), %xmm0     # 0xfeb0
movups %xmm0, 0xb9d0(%rip)     # 0x156b8
movups %xmm0, 0xb9d9(%rip)     # 0x156c8
movl $0x1, 0xb9df(%rip)      # 0x156d8
leaq 0x10(%rsp), %rdi
movl $0x30, %esi
callq 0x9f0a
leaq 0x1ba59(%rip), %rbx     # 0x25768
cmpl $0x0, (%rbx)
je 0x9d1b
callq 0xa07d
jmp 0x9d2c
leaq 0x1ba4a(%rip), %r15     # 0x2576c
cmpl $0x0, (%r15)
je 0x9ed0
leaq 0xb8a5(%rip), %rax      # 0x155d8
movq (%rax), %rax
leaq 0x10(%rsp), %rdi
movl $0x30, %esi
callq *%rax
movb $0x1, 0xb94b(%rip)      # 0x15694
movq %r12, %rbx
testq %rbx, %rbx
je 0x9ebd
movl 0xb97d(%rip), %eax      # 0x156d8
leaq 0xb936(%rip), %r12      # 0x15698
leaq 0xb94f(%rip), %r13      # 0x156b8
cmpl $0x100, %eax            # imm = 0x100
movq %rbx, 0x8(%rsp)
jbe 0x9daf
movl $0x20, %esi
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0xb773
testl %eax, %eax
jne 0x9cbc
movl $0x20, %esi
movq %r15, %rdi
callq 0x9f0a
leaq 0x1b9c5(%rip), %rax     # 0x25768
cmpl $0x0, (%rax)
je 0x9dc3
callq 0xa07d
jmp 0x9dd3
movl $0x10000, %eax          # imm = 0x10000
cmpq %rax, %rbx
movl $0x10000, %r15d         # imm = 0x10000
cmovbq %rbx, %r15
jmp 0x9e13
leaq 0x1b9a2(%rip), %rax     # 0x2576c
cmpl $0x0, (%rax)
je 0x9e95
movl $0x1, 0xb8fb(%rip)      # 0x156d8
leaq 0xb7f4(%rip), %rax      # 0x155d8
movq (%rax), %rax
movl $0x20, %esi
movq %r15, %rdi
callq *%rax
movl $0x10000, %eax          # imm = 0x10000
cmpq %rax, %rbx
movl $0x10000, %r15d         # imm = 0x10000
cmovbq %rbx, %r15
cmpl $0x100, 0xb8cb(%rip)    # imm = 0x100
ja 0x9eeb
movq %r15, %rbp
xorl %ebx, %ebx
movl $0x20, %esi
movl $0x20, %ecx
movq %r12, %rdi
movq %r13, %rdx
movq %r13, %r8
callq 0x689c
leaq (%r14,%rbx), %rdi
cmpq $0x20, %rbp
jb 0x9e51
movups 0xb887(%rip), %xmm0     # 0x156c8
movups %xmm0, 0x10(%rdi)
movups 0xb86c(%rip), %xmm0     # 0x156b8
movups %xmm0, (%rdi)
jmp 0x9e5c
movq %r13, %rsi
movq %rbp, %rdx
callq 0x24b0
addq $0x20, %rbx
addq $-0x20, %rbp
cmpq %r15, %rbx
jb 0x9e18
xorl %ebp, %ebp
xorl %edi, %edi
xorl %esi, %esi
callq 0x9f0a
movl 0xb85e(%rip), %eax      # 0x156d8
incl %eax
movl %eax, 0xb856(%rip)      # 0x156d8
addq %r15, %r14
movq 0x8(%rsp), %rbx
subq %r15, %rbx
jne 0x9d69
jmp 0x9ebf
callq 0xc7dc
leaq 0x1b8c7(%rip), %rcx     # 0x25768
movl %eax, (%rcx)
leaq 0x1b8c2(%rip), %rcx     # 0x2576c
movl $0x1, (%rcx)
testl %eax, %eax
jne 0x9da8
jmp 0x9dd3
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xc7dc
movl %eax, (%rbx)
movl $0x1, (%r15)
testl %eax, %eax
jne 0x9d14
jmp 0x9d2c
leaq 0x6016(%rip), %rdi      # 0xff08
leaq 0x5fc7(%rip), %rsi      # 0xfec0
leaq 0x5fe7(%rip), %rcx      # 0xfee7
movl $0xb8, %edx
callq 0x2130