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

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

	ext = msglen + ((bits + suffix_len + 7) >> 3) + (size_t)rr;
	if (__builtin_expect(state->mptr + ext > state->mlen, 0)) {
		state->mlen += ext;
		new = realloc(state->M, state->mlen * sizeof(char));
		if (!new) {
			state->mlen -= ext;
			return -1;
		}
		state->M = new;
	}

	if (msglen)
		__builtin_memcpy(state->M + state->mptr, msg, msglen * sizeof(char));
	state->mptr += msglen;

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

	state->mptr = libkeccak_pad10star1((size_t)state->r, state->M, state->mptr, bits);
	libkeccak_absorption_phase(state, state->M, state->mptr);

	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);
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
sarq $0x3, %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x3621
movq -0x30(%rbp), %rdi
callq 0x1050
movq %rax, -0x70(%rbp)
jmp 0x3629
xorl %eax, %eax
movq %rax, -0x70(%rbp)
jmp 0x3629
movq -0x70(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x364a
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
jmp 0x3666
movq -0x28(%rbp), %rax
shrq $0x3, %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
andq $0x7, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
addq -0x58(%rbp), %rcx
addq $0x7, %rcx
shrq $0x3, %rcx
addq %rcx, %rax
addq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x108(%rax), %rax
addq -0x60(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x110(%rcx), %rax
seta %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x3723
movq -0x60(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x110(%rax), %rcx
movq %rcx, 0x110(%rax)
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x110(%rax), %rsi
shlq $0x0, %rsi
callq 0x10c0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x3714
movq -0x60(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x110(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x110(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3983
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x118(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x3751
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rdi
movq -0x10(%rbp), %rax
addq 0x108(%rax), %rdi
movq -0x40(%rbp), %rsi
movq -0x20(%rbp), %rdx
shlq $0x0, %rdx
callq 0x10a0
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x108(%rax), %rcx
movq %rcx, 0x108(%rax)
cmpq $0x0, -0x28(%rbp)
je 0x37aa
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x28(%rbp), %rcx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
subl $0x1, %ecx
movzbl %cl, %ecx
andl %ecx, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x108(%rcx), %rcx
movb %dl, (%rax,%rcx)
cmpq $0x0, -0x58(%rbp)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x388a
cmpq $0x0, -0x28(%rbp)
jne 0x37e8
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x108(%rcx), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x37ea
movq -0x58(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x58(%rbp)
cmpq $0x0, %rax
je 0x3888
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movsbl (%rax), %eax
andl $0x1, %eax
movq -0x28(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
shll %cl, %eax
movzbl %al, %esi
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x108(%rcx), %rcx
movzbl (%rax,%rcx), %edx
orl %esi, %edx
movb %dl, (%rax,%rcx)
cmpq $0x8, -0x28(%rbp)
jne 0x3883
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rax
movq -0x10(%rbp), %rdx
movq 0x108(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x108(%rdx)
movb $0x0, 0x1(%rax,%rcx)
jmp 0x37ea
jmp 0x388a
cmpq $0x0, -0x28(%rbp)
je 0x38a7
movq -0x10(%rbp), %rax
movq 0x108(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x108(%rax)
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x108(%rax), %rdx
movq -0x28(%rbp), %rcx
callq 0x2df0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x108(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x118(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x108(%rax), %rdx
callq 0x15a0
cmpq $0x0, -0x38(%rbp)
je 0x393a
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0xd8(%rax), %rdx
addq $0x7, %rdx
sarq $0x3, %rdx
movq -0x10(%rbp), %rax
movq 0xe8(%rax), %rcx
sarq $0x3, %rcx
movq -0x38(%rbp), %r8
callq 0x2f60
jmp 0x397c
movq -0x10(%rbp), %rax
movq 0xd8(%rax), %rax
subq $0x1, %rax
movq -0x10(%rbp), %rcx
cqto
idivq 0xc8(%rcx)
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x68(%rbp)
cmpq $0x0, %rax
je 0x397a
movq -0x10(%rbp), %rdi
callq 0x34d0
jmp 0x395a
jmp 0x397c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)