// File: /workspace/github_c_makefile_star2_O1/rb-de0[P]hashverifier-for-monacoin/Lyra2RE/Sponge.c
// Function: reducedDuplexRow1
inline void reducedDuplexRow1(uint64_t *state, uint64_t *rowIn, uint64_t *rowOut, uint64_t nCols) {
    uint64_t* ptrWordIn = rowIn;				//In Lyra2: pointer to prev
    uint64_t* ptrWordOut = rowOut + (nCols-1)*BLOCK_LEN_INT64; //In Lyra2: pointer to row
    int i;

    for (i = 0; i < nCols; i++) {

	//Absorbing "M[prev][col]"
	state[0]  ^= (ptrWordIn[0]);
	state[1]  ^= (ptrWordIn[1]);
	state[2]  ^= (ptrWordIn[2]);
	state[3]  ^= (ptrWordIn[3]);
	state[4]  ^= (ptrWordIn[4]);
	state[5]  ^= (ptrWordIn[5]);
	state[6]  ^= (ptrWordIn[6]);
	state[7]  ^= (ptrWordIn[7]);
	state[8]  ^= (ptrWordIn[8]);
	state[9]  ^= (ptrWordIn[9]);
	state[10] ^= (ptrWordIn[10]);
	state[11] ^= (ptrWordIn[11]);

	//Applies the reduced-round transformation f to the sponge's state
	reducedBlake2bLyra(state);

	//M[row][C-1-col] = M[prev][col] XOR rand
	ptrWordOut[0] = ptrWordIn[0]  ^ state[0];
	ptrWordOut[1] = ptrWordIn[1]  ^ state[1];
	ptrWordOut[2] = ptrWordIn[2]  ^ state[2];
	ptrWordOut[3] = ptrWordIn[3]  ^ state[3];
	ptrWordOut[4] = ptrWordIn[4]  ^ state[4];
	ptrWordOut[5] = ptrWordIn[5]  ^ state[5];
	ptrWordOut[6] = ptrWordIn[6]  ^ state[6];
	ptrWordOut[7] = ptrWordIn[7]  ^ state[7];
	ptrWordOut[8] = ptrWordIn[8]  ^ state[8];
	ptrWordOut[9] = ptrWordIn[9]  ^ state[9];
	ptrWordOut[10] = ptrWordIn[10] ^ state[10];
	ptrWordOut[11] = ptrWordIn[11] ^ state[11];


	//Input: next column (i.e., next block in sequence)
	ptrWordIn += BLOCK_LEN_INT64;
	//Output: goes to previous column
	ptrWordOut -= BLOCK_LEN_INT64;
    }
}

// Assembly:
testq %rcx, %rcx
je 0x42dc
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq (%rcx,%rcx,2), %rax
shlq $0x5, %rax
leaq (%rax,%rdx), %r12
addq $-0x8, %r12
movq (%r14), %rax
xorq %rax, (%r15)
movq 0x8(%r14), %rax
xorq %rax, 0x8(%r15)
movq 0x10(%r14), %rax
xorq %rax, 0x10(%r15)
movq 0x18(%r14), %rax
xorq %rax, 0x18(%r15)
movq 0x20(%r14), %rax
xorq %rax, 0x20(%r15)
movq 0x28(%r14), %rax
xorq %rax, 0x28(%r15)
movq 0x30(%r14), %rax
xorq %rax, 0x30(%r15)
movq 0x38(%r14), %rax
xorq %rax, 0x38(%r15)
movq 0x40(%r14), %rax
xorq %rax, 0x40(%r15)
movq 0x48(%r14), %rax
xorq %rax, 0x48(%r15)
movq 0x50(%r14), %rax
xorq %rax, 0x50(%r15)
movq 0x58(%r14), %rax
xorq %rax, 0x58(%r15)
movq %r15, %rdi
callq 0x3f23
movq (%r15), %rax
xorq (%r14), %rax
movq %rax, -0x58(%r12)
movq 0x8(%r15), %rax
xorq 0x8(%r14), %rax
movq %rax, -0x50(%r12)
movq 0x10(%r15), %rax
xorq 0x10(%r14), %rax
movq %rax, -0x48(%r12)
movq 0x18(%r15), %rax
xorq 0x18(%r14), %rax
movq %rax, -0x40(%r12)
movq 0x20(%r15), %rax
xorq 0x20(%r14), %rax
movq %rax, -0x38(%r12)
movq 0x28(%r15), %rax
xorq 0x28(%r14), %rax
movq %rax, -0x30(%r12)
movq 0x30(%r15), %rax
xorq 0x30(%r14), %rax
movq %rax, -0x28(%r12)
movq 0x38(%r15), %rax
xorq 0x38(%r14), %rax
movq %rax, -0x20(%r12)
movq 0x40(%r15), %rax
xorq 0x40(%r14), %rax
movq %rax, -0x18(%r12)
movq 0x48(%r15), %rax
xorq 0x48(%r14), %rax
movq %rax, -0x10(%r12)
movq 0x50(%r15), %rax
xorq 0x50(%r14), %rax
movq %rax, -0x8(%r12)
movq 0x58(%r15), %rax
xorq 0x58(%r14), %rax
movq %rax, (%r12)
addq $0x60, %r14
addq $-0x60, %r12
decq %rbx
jne 0x41c4
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq