// File: /workspace/github_c_makefile_star2_O0/maandree[P]libkeccak/libkeccak_state_initialise.c
// Function: libkeccak_state_initialise
int
libkeccak_state_initialise(struct libkeccak_state *restrict state, const struct libkeccak_spec *restrict spec)
{
	long int x;

	state->r = spec->bitrate;
	state->n = spec->output;
	state->c = spec->capacity;
	state->b = state->r + state->c;
	state->w = x = state->b / 25;
	state->l = 0;

	if (x & 0xF0L) {
		state->l |= 4;
		x >>= 4;
	}
	if (x & 0x0CL) {
		state->l |= 2;
		x >>= 2;
	}
	if (x & 0x02L) {
		state->l |= 1;
	}

	state->nr = 12 + (state->l << 1);
	state->wmod = (state->w == 64) ? ~0ULL : (uint64_t)((1ULL << state->w) - 1);
	for (x = 0; x < 25; x++)
		state->S.w64[x] = 0;
	state->mptr = 0;
	state->mlen = (size_t)(state->r * state->b) >> 2;

	state->M = malloc(state->mlen * sizeof(char));
	return state->M == NULL ? -1 : 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xc8(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xd8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xd0(%rax)
movq -0x8(%rbp), %rax
movq 0xc8(%rax), %rcx
movq -0x8(%rbp), %rax
addq 0xd0(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xe0(%rax)
movq -0x8(%rbp), %rax
movq 0xe0(%rax), %rax
movl $0x19, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq %rcx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rcx, 0xe8(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0xf8(%rax)
movq -0x18(%rbp), %rax
andq $0xf0, %rax
cmpq $0x0, %rax
je 0x66c1
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rcx
orq $0x4, %rcx
movq %rcx, 0xf8(%rax)
movq -0x18(%rbp), %rax
sarq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
andq $0xc, %rax
cmpq $0x0, %rax
je 0x66f1
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rcx
orq $0x2, %rcx
movq %rcx, 0xf8(%rax)
movq -0x18(%rbp), %rax
sarq $0x2, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
andq $0x2, %rax
cmpq $0x0, %rax
je 0x6715
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rcx
orq $0x1, %rcx
movq %rcx, 0xf8(%rax)
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rcx
shlq %rcx
addq $0xc, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x100(%rax)
movq -0x8(%rbp), %rax
cmpq $0x40, 0xe8(%rax)
jne 0x674d
movq $-0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x6768
movq -0x8(%rbp), %rax
movq 0xe8(%rax), %rcx
movl $0x1, %eax
shlq %cl, %rax
subq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xf0(%rax)
movq $0x0, -0x18(%rbp)
cmpq $0x19, -0x18(%rbp)
jge 0x67a4
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x677f
movq -0x8(%rbp), %rax
movq $0x0, 0x108(%rax)
movq -0x8(%rbp), %rax
movq 0xc8(%rax), %rcx
movq -0x8(%rbp), %rax
imulq 0xe0(%rax), %rcx
shrq $0x2, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x110(%rax)
movq -0x8(%rbp), %rax
movq 0x110(%rax), %rdi
shlq $0x0, %rdi
callq 0x10b0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x118(%rax)
movq -0x8(%rbp), %rax
movq 0x118(%rax), %rdx
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq $0x0, %rdx
cmovel %ecx, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)