// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]libcperciva/liball/../crypto/crypto_aesctr.c
// Function: crypto_aesctr_stream
void
crypto_aesctr_stream(struct crypto_aesctr * stream, const uint8_t * inbuf,
    uint8_t * outbuf, size_t buflen)
{

#if defined(HWACCEL)
#if defined(CPUSUPPORT_X86_AESNI)
	if ((buflen >= 16) && (hwaccel == HW_X86_AESNI)) {
		crypto_aesctr_aesni_stream(stream, inbuf, outbuf, buflen);
		return;
	}
#endif
#if defined(CPUSUPPORT_ARM_AES)
	if ((buflen >= 16) && (hwaccel == HW_ARM_AES)) {
		crypto_aesctr_arm_stream(stream, inbuf, outbuf, buflen);
		return;
	}
#endif
#endif /* HWACCEL */

	/* Process any bytes before we can process a whole block. */
	if (crypto_aesctr_stream_pre_wholeblock(stream, &inbuf, &outbuf,
	    &buflen))
		return;

	/* Process whole blocks of 16 bytes. */
	while (buflen >= 16) {
		/* Generate a block of cipherstream. */
		crypto_aesctr_stream_cipherblock_generate(stream);

		/* Encrypt the bytes and update the positions. */
		crypto_aesctr_stream_cipherblock_use(stream, &inbuf, &outbuf,
		    &buflen, 16, 0);
	}

	/* Process any final bytes after finishing all whole blocks. */
	crypto_aesctr_stream_post_wholeblock(stream, &inbuf, &outbuf, &buflen);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
cmpq $0x10, %rcx
jb 0x3d20
cmpl $0x1, 0x64f1(%rip)      # 0xa1f0
jne 0x3d20
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3fdc
movq 0x8(%r12), %rdx
movb $0x1, %al
andq $0xf, %rdx
je 0x3d9d
leaq (%rdx,%rbx), %rcx
cmpq $0x10, %rcx
ja 0x3d6a
testq %rbx, %rbx
je 0x3d59
leaq (%rdx,%r12), %rax
addq $0x10, %rax
xorl %ecx, %ecx
movb (%rax,%rcx), %dl
xorb (%r15,%rcx), %dl
movb %dl, (%r14,%rcx)
incq %rcx
cmpq %rcx, %rbx
jne 0x3d46
addq %rbx, 0x8(%r12)
addq %rbx, %r15
addq %rbx, %r14
xorl %ebx, %ebx
xorl %eax, %eax
jmp 0x3d9d
movl $0x10, %ecx
subq %rdx, %rcx
addq %r12, %rdx
addq $0x10, %rdx
xorl %esi, %esi
movb (%rdx,%rsi), %dil
xorb (%r15,%rsi), %dil
movb %dil, (%r14,%rsi)
incq %rsi
cmpq %rsi, %rcx
jne 0x3d7b
addq %rcx, 0x8(%r12)
addq %rcx, %r15
addq %rcx, %r14
subq %rcx, %rbx
testb %al, %al
je 0x3f0c
cmpq $0x10, %rbx
jb 0x3e66
leaq 0x20(%r12), %r13
leaq 0x10(%r12), %rbp
movq 0x8(%r12), %rax
testb $0xf, %al
jne 0x3f1b
incb 0x2f(%r12)
jne 0x3e24
movl %eax, %ecx
shrl $0x4, %ecx
movb %cl, 0x2f(%r12)
movl %eax, %ecx
shrl $0xc, %ecx
movb %cl, 0x2e(%r12)
movl %eax, %ecx
shrl $0x14, %ecx
movb %cl, 0x2d(%r12)
movq %rax, %rcx
shrq $0x1c, %rcx
movb %cl, 0x2c(%r12)
movq %rax, %rcx
shrq $0x24, %rcx
movb %cl, 0x2b(%r12)
movq %rax, %rcx
shrq $0x2c, %rcx
movb %cl, 0x2a(%r12)
movq %rax, %rcx
shrq $0x34, %rcx
movb %cl, 0x29(%r12)
shrq $0x3c, %rax
movb %al, 0x28(%r12)
movq (%r12), %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x34bd
xorl %eax, %eax
movb (%rbp,%rax), %cl
xorb (%r15,%rax), %cl
movb %cl, (%r14,%rax)
incq %rax
cmpq $0x10, %rax
jne 0x3e35
addq $0x10, 0x8(%r12)
addq $0x10, %r15
addq $0x10, %r14
addq $-0x10, %rbx
cmpq $0xf, %rbx
ja 0x3db9
testq %rbx, %rbx
je 0x3f0c
movq 0x8(%r12), %rax
testb $0xf, %al
jne 0x3f1b
incb 0x2f(%r12)
jne 0x3eda
movl %eax, %ecx
shrl $0x4, %ecx
movb %cl, 0x2f(%r12)
movl %eax, %ecx
shrl $0xc, %ecx
movb %cl, 0x2e(%r12)
movl %eax, %ecx
shrl $0x14, %ecx
movb %cl, 0x2d(%r12)
movq %rax, %rcx
shrq $0x1c, %rcx
movb %cl, 0x2c(%r12)
movq %rax, %rcx
shrq $0x24, %rcx
movb %cl, 0x2b(%r12)
movq %rax, %rcx
shrq $0x2c, %rcx
movb %cl, 0x2a(%r12)
movq %rax, %rcx
shrq $0x34, %rcx
movb %cl, 0x29(%r12)
shrq $0x3c, %rax
movb %al, 0x28(%r12)
leaq 0x20(%r12), %rdi
leaq 0x10(%r12), %r13
movq (%r12), %rdx
movq %r13, %rsi
callq 0x34bd
xorl %eax, %eax
movb (%r13,%rax), %cl
xorb (%r15,%rax), %cl
movb %cl, (%r14,%rax)
incq %rax
cmpq %rax, %rbx
jne 0x3ef2
addq %rbx, 0x8(%r12)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2a99(%rip), %rdi      # 0x69bb
leaq 0x2aac(%rip), %rsi      # 0x69d5
leaq 0x2ac6(%rip), %rcx      # 0x69f6
movl $0x15, %edx
callq 0x20a0