// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/norx6444v2/ref/norx.c
// Function: norx_encrypt_data
void norx_encrypt_data(norx_state_t state, unsigned char *out, const unsigned char * in, size_t inlen)
{
    if (inlen > 0)
    {
        size_t i;
        norx_state_t lane[NORX_P];

        /* Initialize states + branch */
        for (i = 0; i < NORX_P; ++i) {
            memcpy(lane[i], state, sizeof lane[i]);
            norx_branch(lane[i], i);
        }

        /* Parallel payload processing */
        for (i = 0; inlen >= BYTES(NORX_R); ++i) {
            norx_encrypt_block(lane[i%NORX_P], out, in);
            #if defined(NORX_DEBUG)
            printf("Encrypt block (lane: %lu)\n", i%NORX_P);
            norx_debug(lane[i%NORX_P], in, BYTES(NORX_R), out, BYTES(NORX_R));
            #endif
            inlen -= BYTES(NORX_R);
            out   += BYTES(NORX_R);
            in    += BYTES(NORX_R);
        }
        norx_encrypt_lastblock(lane[i%NORX_P], out, in, inlen);
        #if defined(NORX_DEBUG)
        printf("Encrypt lastblock (lane: %lu)\n", i%NORX_P);
        norx_debug(lane[i%NORX_P], in, inlen, out, inlen);
        #endif

        /* Merge */
        memset(state, 0, sizeof(norx_state_t));
        for (i = 0; i < NORX_P; ++i) {
            norx_merge(state, lane[i]);
            burn(lane[i], 0, sizeof(norx_state_t));
        }

        #if defined(NORX_DEBUG)
        printf("Encryption finalised\n");
        norx_debug(state, NULL, 0, NULL, 0);
        #endif
    }
}

// Assembly:
subq $0x228, %rsp            # imm = 0x228
movq %rdi, 0x220(%rsp)
movq %rsi, 0x218(%rsp)
movq %rdx, 0x210(%rsp)
movq %rcx, 0x208(%rsp)
cmpq $0x0, 0x208(%rsp)
jbe 0x1668
movq $0x0, 0x200(%rsp)
cmpq $0x4, 0x200(%rsp)
jae 0x1516
movq 0x200(%rsp), %rax
movq %rsp, %rdi
shlq $0x7, %rax
addq %rax, %rdi
movq 0x220(%rsp), %rsi
movl $0x80, %edx
callq 0x10d0
movq 0x200(%rsp), %rax
movq %rsp, %rdi
shlq $0x7, %rax
addq %rax, %rdi
movq 0x200(%rsp), %rsi
callq 0x1670
movq 0x200(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x200(%rsp)
jmp 0x14b2
movq $0x0, 0x200(%rsp)
cmpq $0x60, 0x208(%rsp)
jb 0x15b1
movq 0x200(%rsp), %rax
andq $0x3, %rax
movq %rsp, %rdi
shlq $0x7, %rax
addq %rax, %rdi
movq 0x218(%rsp), %rsi
movq 0x210(%rsp), %rdx
callq 0x16c0
movq 0x208(%rsp), %rax
subq $0x60, %rax
movq %rax, 0x208(%rsp)
movq 0x218(%rsp), %rax
addq $0x60, %rax
movq %rax, 0x218(%rsp)
movq 0x210(%rsp), %rax
addq $0x60, %rax
movq %rax, 0x210(%rsp)
movq 0x200(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x200(%rsp)
jmp 0x1522
movq 0x200(%rsp), %rax
andq $0x3, %rax
movq %rsp, %rdi
shlq $0x7, %rax
addq %rax, %rdi
movq 0x218(%rsp), %rsi
movq 0x210(%rsp), %rdx
movq 0x208(%rsp), %rcx
callq 0x1770
movq 0x220(%rsp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x1030
movq $0x0, 0x200(%rsp)
cmpq $0x4, 0x200(%rsp)
jae 0x1666
movq 0x220(%rsp), %rdi
movq 0x200(%rsp), %rax
movq %rsp, %rsi
shlq $0x7, %rax
addq %rax, %rsi
callq 0x17d0
movq 0x47d3(%rip), %rax      # 0x5e08
movq 0x200(%rsp), %rcx
movq %rsp, %rdi
shlq $0x7, %rcx
addq %rcx, %rdi
xorl %esi, %esi
movl $0x80, %edx
callq *%rax
movq 0x200(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x200(%rsp)
jmp 0x1604
jmp 0x1668
addq $0x228, %rsp            # imm = 0x228
retq