// File: /workspace/github_c_makefile_star2_O3/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 0x42d7
cmpl $0x1, 0x5f3a(%rip)      # 0xa1f0
jne 0x42d7
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 0x459c
movq 0x8(%r12), %rax
movq %rax, %rsi
andq $0xf, %rsi
je 0x4369
leaq (%rsi,%rbx), %rcx
cmpq $0x10, %rcx
jbe 0x4323
movl $0x10, %edx
subq %rsi, %rdx
leaq (%rsi,%r12), %rax
addq $0x10, %rax
xorl %esi, %esi
movb (%rax,%rsi), %dil
xorb (%r15,%rsi), %dil
movb %dil, (%r14,%rsi)
incq %rsi
cmpq %rsi, %rdx
jne 0x4305
movq 0x8(%r12), %rax
addq %rdx, %rax
jmp 0x4351
testq %rbx, %rbx
je 0x434b
leaq (%rsi,%r12), %rax
addq $0x10, %rax
xorl %edx, %edx
movb (%rax,%rdx), %sil
xorb (%r15,%rdx), %sil
movb %sil, (%r14,%rdx)
incq %rdx
cmpq %rdx, %rbx
jne 0x4332
movq 0x8(%r12), %rax
addq %rbx, %rax
movq %rbx, %rdx
movq %rax, 0x8(%r12)
cmpq $0x11, %rcx
jb 0x44ce
addq %rdx, %r15
addq %rdx, %r14
subq %rdx, %rbx
cmpq $0x10, %rbx
jb 0x442d
leaq 0x20(%r12), %r13
leaq 0x10(%r12), %rbp
testb $0xf, %al
jne 0x44dd
incb 0x2f(%r12)
jne 0x43e3
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 0x3a49
xorl %eax, %eax
movb (%rbp,%rax), %cl
xorb (%r15,%rax), %cl
movb %cl, (%r14,%rax)
incq %rax
cmpq $0x10, %rax
jne 0x43f4
movq 0x8(%r12), %rax
addq $0x10, %rax
movq %rax, 0x8(%r12)
addq $0x10, %r15
addq $0x10, %r14
addq $-0x10, %rbx
cmpq $0xf, %rbx
ja 0x437d
testq %rbx, %rbx
je 0x44ce
testb $0xf, %al
jne 0x44dd
incb 0x2f(%r12)
jne 0x449c
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 0x3a49
xorl %eax, %eax
movb (%r13,%rax), %cl
xorb (%r15,%rax), %cl
movb %cl, (%r14,%rax)
incq %rax
cmpq %rax, %rbx
jne 0x44b4
addq %rbx, 0x8(%r12)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x25a7(%rip), %rdi      # 0x6a8b
leaq 0x25ba(%rip), %rsi      # 0x6aa5
leaq 0x25d4(%rip), %rcx      # 0x6ac6
movl $0x15, %edx
callq 0x20a0