// File: /workspace/github_c_makefile_star2_O2/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, %r12
movq %rdi, %r14
cmpb $0x0, 0xb141(%rip)      # 0x12694
jne 0x75d4
leaq 0x10(%rsp), %rdi
pushq $0x30
popq %rsi
callq 0x8cb0
testl %eax, %eax
je 0x756e
pushq $-0x1
popq %rax
jmp 0x76f7
xorps %xmm0, %xmm0
movups %xmm0, 0xb130(%rip)     # 0x126a8
movups %xmm0, 0xb119(%rip)     # 0x12698
movaps 0x586a(%rip), %xmm0     # 0xcdf0
movups %xmm0, 0xb12b(%rip)     # 0x126b8
movups %xmm0, 0xb134(%rip)     # 0x126c8
movl $0x1, 0xb13a(%rip)      # 0x126d8
leaq 0x10(%rsp), %rdi
pushq $0x30
popq %rsi
callq 0x7725
callq 0x788c
testl %eax, %eax
je 0x75b9
callq 0x78c6
leaq 0xb018(%rip), %rax      # 0x125d8
movq (%rax), %rax
leaq 0x10(%rsp), %rdi
pushq $0x30
popq %rsi
callq *%rax
movb $0x1, 0xb0c0(%rip)      # 0x12694
leaq 0x10(%rsp), %rbx
pushq $0x20
popq %r13
leaq 0xb0d4(%rip), %r15      # 0x126b8
testq %r12, %r12
je 0x76f5
cmpl $0x100, 0xb0e1(%rip)    # imm = 0x100
movq %r12, 0x8(%rsp)
jbe 0x7668
movq %rbx, %rdi
movq %r13, %rsi
callq 0x8cb0
testl %eax, %eax
jne 0x7566
movq %rbx, %rdi
movq %r13, %rsi
callq 0x7725
callq 0x788c
testl %eax, %eax
je 0x762a
callq 0x78c6
movl $0x1, 0xb0a4(%rip)      # 0x126d8
leaq 0xaf9d(%rip), %rax      # 0x125d8
movq (%rax), %rax
movq %rbx, %rdi
movq %r13, %rsi
callq *%rax
movl $0x10000, %eax          # imm = 0x10000
cmpq %rax, %r12
movl $0x10000, %ebx          # imm = 0x10000
cmovbq %r12, %rbx
cmpl $0x100, 0xb077(%rip)    # imm = 0x100
jbe 0x7679
jmp 0x7706
movl $0x10000, %eax          # imm = 0x10000
cmpq %rax, %r12
movl $0x10000, %ebx          # imm = 0x10000
cmovbq %r12, %rbx
movq %rbx, %r12
xorl %ebp, %ebp
cmpq %rbx, %rbp
jae 0x76d1
leaq 0xb00e(%rip), %rdi      # 0x12698
movq %r13, %rsi
movq %r15, %rdx
movq %r13, %rcx
movq %r15, %r8
callq 0x4486
leaq (%r14,%rbp), %rdi
cmpq $0x20, %r12
jb 0x76bc
movups 0xb01c(%rip), %xmm0     # 0x126c8
movups %xmm0, 0x10(%rdi)
movups 0xb001(%rip), %xmm0     # 0x126b8
movups %xmm0, (%rdi)
jmp 0x76c7
movq %r15, %rsi
movq %r12, %rdx
callq 0x24b0
addq $0x20, %rbp
addq $-0x20, %r12
jmp 0x767e
xorl %edi, %edi
xorl %esi, %esi
callq 0x7725
incl 0xaff8(%rip)            # 0x126d8
addq %rbx, %r14
movq 0x8(%rsp), %r12
subq %rbx, %r12
leaq 0x10(%rsp), %rbx
jmp 0x75e4
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x573b(%rip), %rdi      # 0xce48
leaq 0x56ec(%rip), %rsi      # 0xce00
leaq 0x570c(%rip), %rcx      # 0xce27
movl $0xb8, %edx
callq 0x2130