// File: /workspace/github_c_makefile_star2_O2/LoupVaillant[P]Monocypher-Utils/src/monocypher.c
// Function: chacha20_rounds
static void chacha20_rounds(u32 out[16], const u32 in[16])
{
    // The temporary variables make Chacha20 10% faster.
    u32 t0  = in[ 0];  u32 t1  = in[ 1];  u32 t2  = in[ 2];  u32 t3  = in[ 3];
    u32 t4  = in[ 4];  u32 t5  = in[ 5];  u32 t6  = in[ 6];  u32 t7  = in[ 7];
    u32 t8  = in[ 8];  u32 t9  = in[ 9];  u32 t10 = in[10];  u32 t11 = in[11];
    u32 t12 = in[12];  u32 t13 = in[13];  u32 t14 = in[14];  u32 t15 = in[15];

    FOR (i, 0, 10) { // 20 rounds, 2 rounds per loop.
        QUARTERROUND(t0, t4, t8 , t12); // column 0
        QUARTERROUND(t1, t5, t9 , t13); // column 1
        QUARTERROUND(t2, t6, t10, t14); // column 2
        QUARTERROUND(t3, t7, t11, t15); // column 3
        QUARTERROUND(t0, t5, t10, t15); // diagonal 0
        QUARTERROUND(t1, t6, t11, t12); // diagonal 1
        QUARTERROUND(t2, t7, t8 , t13); // diagonal 2
        QUARTERROUND(t3, t4, t9 , t14); // diagonal 3
    }
    out[ 0] = t0;   out[ 1] = t1;   out[ 2] = t2;   out[ 3] = t3;
    out[ 4] = t4;   out[ 5] = t5;   out[ 6] = t6;   out[ 7] = t7;
    out[ 8] = t8;   out[ 9] = t9;   out[10] = t10;  out[11] = t11;
    out[12] = t12;  out[13] = t13;  out[14] = t14;  out[15] = t15;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, -0x10(%rsp)
movl (%rsi), %eax
movl %eax, -0x20(%rsp)
movl 0x4(%rsi), %eax
movl %eax, -0x1c(%rsp)
movl 0x8(%rsi), %eax
movl %eax, -0x18(%rsp)
movl 0xc(%rsi), %eax
movl %eax, -0x24(%rsp)
movl 0x10(%rsi), %r9d
movl 0x14(%rsi), %r10d
movl 0x18(%rsi), %r11d
movl 0x1c(%rsi), %ebx
movl 0x20(%rsi), %edi
movl 0x24(%rsi), %r14d
movl 0x28(%rsi), %r15d
movl 0x2c(%rsi), %r12d
movl 0x30(%rsi), %r13d
movl 0x34(%rsi), %eax
movl 0x38(%rsi), %ecx
movl 0x3c(%rsi), %edx
movabsq $0xa, %rsi
subq $0x1, %rsi
jb 0x19a0
movl -0x20(%rsp), %r8d
addl %r9d, %r8d
xorl %r8d, %r13d
roll $0x10, %r13d
addl %r13d, %edi
xorl %edi, %r9d
roll $0xc, %r9d
addl %r9d, %r8d
xorl %r8d, %r13d
roll $0x8, %r13d
addl %r13d, %edi
movl %edi, -0x14(%rsp)
xorl %edi, %r9d
roll $0x7, %r9d
movl -0x1c(%rsp), %edi
addl %r10d, %edi
xorl %edi, %eax
roll $0x10, %eax
addl %eax, %r14d
xorl %r14d, %r10d
roll $0xc, %r10d
addl %r10d, %edi
xorl %edi, %eax
roll $0x8, %eax
addl %eax, %r14d
xorl %r14d, %r10d
roll $0x7, %r10d
movq %rsi, -0x8(%rsp)
movl -0x18(%rsp), %esi
addl %r11d, %esi
xorl %esi, %ecx
roll $0x10, %ecx
addl %ecx, %r15d
xorl %r15d, %r11d
roll $0xc, %r11d
addl %r11d, %esi
xorl %esi, %ecx
roll $0x8, %ecx
addl %ecx, %r15d
xorl %r15d, %r11d
roll $0x7, %r11d
movl -0x24(%rsp), %ebp
addl %ebx, %ebp
xorl %ebp, %edx
roll $0x10, %edx
addl %edx, %r12d
xorl %r12d, %ebx
roll $0xc, %ebx
addl %ebx, %ebp
xorl %ebp, %edx
roll $0x8, %edx
addl %edx, %r12d
xorl %r12d, %ebx
roll $0x7, %ebx
addl %r10d, %r8d
xorl %r8d, %edx
roll $0x10, %edx
addl %edx, %r15d
xorl %r15d, %r10d
roll $0xc, %r10d
addl %r10d, %r8d
movl %r8d, -0x20(%rsp)
xorl %r8d, %edx
roll $0x8, %edx
addl %edx, %r15d
xorl %r15d, %r10d
roll $0x7, %r10d
addl %r11d, %edi
xorl %edi, %r13d
roll $0x10, %r13d
addl %r13d, %r12d
xorl %r12d, %r11d
roll $0xc, %r11d
addl %r11d, %edi
movl %edi, -0x1c(%rsp)
xorl %edi, %r13d
movl -0x14(%rsp), %edi
roll $0x8, %r13d
addl %r13d, %r12d
xorl %r12d, %r11d
roll $0x7, %r11d
addl %ebx, %esi
xorl %esi, %eax
roll $0x10, %eax
addl %eax, %edi
xorl %edi, %ebx
roll $0xc, %ebx
addl %ebx, %esi
movl %esi, -0x18(%rsp)
xorl %esi, %eax
movq -0x8(%rsp), %rsi
roll $0x8, %eax
addl %eax, %edi
xorl %edi, %ebx
roll $0x7, %ebx
addl %r9d, %ebp
xorl %ebp, %ecx
roll $0x10, %ecx
addl %ecx, %r14d
xorl %r14d, %r9d
roll $0xc, %r9d
addl %r9d, %ebp
movl %ebp, -0x24(%rsp)
xorl %ebp, %ecx
roll $0x8, %ecx
addl %ecx, %r14d
xorl %r14d, %r9d
roll $0x7, %r9d
jmp 0x183f
movq -0x10(%rsp), %r8
movl -0x20(%rsp), %esi
movl %esi, (%r8)
movl -0x1c(%rsp), %esi
movl %esi, 0x4(%r8)
movl -0x18(%rsp), %esi
movl %esi, 0x8(%r8)
movl -0x24(%rsp), %esi
movl %esi, 0xc(%r8)
movl %r9d, 0x10(%r8)
movl %r10d, 0x14(%r8)
movl %r11d, 0x18(%r8)
movl %ebx, 0x1c(%r8)
movl %edi, 0x20(%r8)
movl %r14d, 0x24(%r8)
movl %r15d, 0x28(%r8)
movl %r12d, 0x2c(%r8)
movl %r13d, 0x30(%r8)
movl %eax, 0x34(%r8)
movl %ecx, 0x38(%r8)
movl %edx, 0x3c(%r8)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq