// File: /workspace/github_c_makefile_star2_O3/maandree[P]libkeccak/digest.c
// Function: libkeccak_zerocopy_digest
void
libkeccak_zerocopy_digest(struct libkeccak_state *restrict state, void *restrict msg_, size_t msglen,
                          size_t bits, const char *restrict suffix, void *restrict hashsum)
{
	unsigned char *restrict msg = msg_;
	register long int rr = state->r >> 3;
	auto size_t suffix_len = suffix ? __builtin_strlen(suffix) : 0;
	register long int i;

	if (!msg) {
		msglen = 0;
		bits = 0;
	} else {
		msglen += bits >> 3;
		bits &= 7;
	}

	if (bits)
		msg[msglen] = msg[msglen] & (unsigned char)((1 << bits) - 1);
	if (__builtin_expect(!!suffix_len, 1)) {
		if (!bits)
			msg[msglen] = 0;
		while (suffix_len--) {
			msg[msglen] |= (unsigned char)((*suffix++ & 1) << bits++);
			if (bits == 8) {
				bits = 0;
				msg[++msglen] = 0;
			}
		}
	}
	if (bits)
		msglen++;

	msglen = libkeccak_pad10star1((size_t)state->r, msg, msglen, bits);
	libkeccak_absorption_phase(state, msg, msglen);

	if (hashsum) {
		libkeccak_squeezing_phase(state, rr, (state->n + 7) >> 3, state->w >> 3, hashsum);
	} else {
		for (i = (state->n - 1) / state->r; i--;)
			libkeccak_f(state);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, (%rsp)
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
movq 0xc8(%rdi), %r15
testq %r8, %r8
je 0x383c
movq %r8, %rbp
movq %r8, %rdi
callq 0x1050
movq %r13, %r8
shrq $0x3, %r8
addq %r14, %r8
andq $0x7, %r13
je 0x3865
movb $-0x1, %dil
movl %r13d, %ecx
shlb %cl, %dil
notb %dil
andb (%r12,%r8), %dil
movb %dil, (%r12,%r8)
testq %rax, %rax
jne 0x386f
jmp 0x392e
movq %r13, %r8
shrq $0x3, %r8
addq %r14, %r8
andq $0x7, %r13
je 0x38c8
movb $-0x1, %dil
movl %r13d, %ecx
shlb %cl, %dil
notb %dil
andb (%r12,%r8), %dil
movb %dil, (%r12,%r8)
jmp 0x392e
testq %rax, %rax
je 0x38c8
movb $0x0, (%r12,%r8)
movb (%r12,%r8), %sil
xorl %edx, %edx
movl %esi, %edi
movzbl (%rbp,%rdx), %esi
andl $0x1, %esi
leaq (%rdx,%r13), %rcx
shll %cl, %esi
orb %dil, %sil
movb %sil, (%r12,%r8)
cmpq $0x7, %rcx
je 0x389f
incq %rdx
cmpq %rdx, %rax
jne 0x3875
jmp 0x3927
movb $0x0, 0x1(%r12,%r8)
incq %r8
movq %rdx, %rcx
notq %rcx
addq %rax, %rcx
decq %rax
addq %rdx, %rbp
incq %rbp
movl $0x0, %r13d
cmpq %rdx, %rax
movq %rcx, %rax
jne 0x386f
leaq (,%r8,8), %rax
xorl %edx, %edx
divq %r15
leaq -0x8(%r15), %rcx
cmpq %rdx, %rcx
setbe %al
leaq -0x2(%r15), %rsi
cmpq %rsi, %rdx
setbe %dl
movb $-0x7f, %sil
testb %dl, %al
jne 0x39a7
leaq 0x1(%r8), %rsi
leaq 0x8(,%r8,8), %rax
xorl %edx, %edx
divq %r15
leaq (%rcx,%r8,8), %r14
addq $0x8, %r14
subq %rdx, %r14
shrq $0x3, %r14
leaq (%r12,%r8), %rdi
incq %rdi
movb $0x1, -0x1(%rdi)
movq %r14, %rdx
subq %rsi, %rdx
jmp 0x3994
movb (%r12,%r8), %dil
addq %rdx, %r13
movl $0x1, %esi
movl %r13d, %ecx
shll %cl, %esi
leaq (,%r8,8), %rax
orq %r13, %rax
xorl %edx, %edx
divq %r15
orb %dil, %sil
leaq -0x8(%r15), %rcx
cmpq %rdx, %rcx
seta %al
leaq -0x2(%r15), %rdi
cmpq %rdi, %rdx
seta %dl
orb %al, %dl
je 0x39a3
leaq 0x1(%r8), %r9
leaq 0x8(,%r8,8), %rax
xorl %edx, %edx
divq %r15
leaq (%rcx,%r8,8), %r14
addq $0x8, %r14
subq %rdx, %r14
shrq $0x3, %r14
leaq (%r12,%r8), %rdi
incq %rdi
movb %sil, -0x1(%rdi)
movq %r14, %rdx
subq %r9, %rdx
xorl %esi, %esi
callq 0x1070
movb $-0x80, %sil
movq %r14, %r8
jmp 0x39a7
addb $-0x80, %sil
movq (%rsp), %r14
movb %sil, (%r12,%r8)
incq %r8
movq %rbx, %rdi
movq %r12, %rsi
movq %r8, %rdx
callq 0x16d2
movq 0xd8(%rbx), %rdx
testq %r14, %r14
je 0x39ff
sarq $0x3, %r15
addq $0x7, %rdx
sarq $0x3, %rdx
movq 0xe8(%rbx), %rcx
sarq $0x3, %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %r8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1110
decq %rdx
movq %rdx, %rax
cqto
idivq 0xc8(%rbx)
testq %rax, %rax
je 0x3a23
movq %rax, %r14
movq %rbx, %rdi
callq 0x3a32
decq %r14
jne 0x3a16
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq