// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/crypto_aead/aezv4/aesni/encrypt.c
// Function: blake2b_compress
static void blake2b_compress(blake2b_ctx *ctx, int last)
{
    const uint8_t sigma[12][16] = {
        { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
        { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 },
        { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 },
        { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 },
        { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 },
        { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 },
        { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 },
        { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 },
        { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 },
        { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 },
        { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
        { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }
    };
    int i;
    uint64_t v[16], m[16];
    
    for (i = 0; i < 8; i++) {
        v[i] = ctx->h[i];
        v[i + 8] = blake2b_iv[i];
    }
    
    v[12] ^= ctx->t[0];
    v[13] ^= ctx->t[1];
    if (last)
        v[14] = ~v[14];
    
    for (i = 0; i < 16; i++)
        m[i] = B2B_GET64(&ctx->b[8 * i]);
    
    for (i = 0; i < 12; i++) {
        B2B_G( 0, 4,  8, 12, m[sigma[i][ 0]], m[sigma[i][ 1]]);
        B2B_G( 1, 5,  9, 13, m[sigma[i][ 2]], m[sigma[i][ 3]]);
        B2B_G( 2, 6, 10, 14, m[sigma[i][ 4]], m[sigma[i][ 5]]);
        B2B_G( 3, 7, 11, 15, m[sigma[i][ 6]], m[sigma[i][ 7]]);
        B2B_G( 0, 5, 10, 15, m[sigma[i][ 8]], m[sigma[i][ 9]]);
        B2B_G( 1, 6, 11, 12, m[sigma[i][10]], m[sigma[i][11]]);
        B2B_G( 2, 7,  8, 13, m[sigma[i][12]], m[sigma[i][13]]);
        B2B_G( 3, 4,  9, 14, m[sigma[i][14]], m[sigma[i][15]]);
    }
    
    for( i = 0; i < 8; ++i )
        ctx->h[i] ^= v[i] ^ v[i + 8];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
vmovdqu 0x80(%rdi), %ymm0
vmovdqu 0xa0(%rdi), %ymm1
vmovdqu %ymm1, -0x20(%rsp)
vmovdqu %ymm0, -0x40(%rsp)
movabsq $0x510e527fade682d1, %r15 # imm = 0x510E527FADE682D1
xorq 0xc0(%rdi), %r15
movabsq $-0x64fa9773d4c193e1, %rbp # imm = 0x9B05688C2B3E6C1F
xorq 0xc8(%rdi), %rbp
leaq 0x80(%rdi), %rax
movq %rax, -0x48(%rsp)
testl %esi, %esi
movabsq $0x1f83d9abfb41bd6b, %rcx # imm = 0x1F83D9ABFB41BD6B
movabsq $-0x1f83d9abfb41bd6c, %rax # imm = 0xE07C265404BE4294
cmoveq %rcx, %rax
xorl %ecx, %ecx
movq (%rdi,%rcx,8), %rdx
movq %rdx, 0x40(%rsp,%rcx,8)
incq %rcx
cmpq $0x10, %rcx
jne 0x322d
movq -0x40(%rsp), %r9
movq -0x38(%rsp), %rdi
movq -0x20(%rsp), %r12
movq -0x18(%rsp), %rcx
movq %rcx, -0x78(%rsp)
movq -0x30(%rsp), %rsi
movq -0x10(%rsp), %rcx
movq %rcx, -0x70(%rsp)
movq -0x28(%rsp), %rdx
movabsq $-0x5ab00ac5a0e2c90f, %rcx # imm = 0xA54FF53A5F1D36F1
movabsq $0x5be0cd19137e2179, %r13 # imm = 0x5BE0CD19137E2179
movabsq $0x3c6ef372fe94f82b, %r8 # imm = 0x3C6EF372FE94F82B
movabsq $-0x4498517a7b3558c5, %r10 # imm = 0xBB67AE8584CAA73B
movabsq $0x6a09e667f3bcc908, %r11 # imm = 0x6A09E667F3BCC908
movl $0xf, %ebx
movq -0x8(%rsp), %r14
movq %rax, -0x68(%rsp)
movq %r14, -0x60(%rsp)
addq %r12, %r9
leaq 0xe74(%rip), %rax       # 0x4130
movzbl -0xf(%rbx,%rax), %r14d
addq 0x40(%rsp,%r14,8), %r9
xorq %r9, %r15
rorxq $0x20, %r15, %r14
addq %r14, %r11
xorq %r11, %r12
rorxq $0x18, %r12, %rax
addq %rax, %r9
leaq 0xe4a(%rip), %r12       # 0x4130
movzbl -0xe(%rbx,%r12), %r15d
addq 0x40(%rsp,%r15,8), %r9
xorq %r9, %r14
rorxq $0x10, %r14, %r14
movq %r14, -0x58(%rsp)
addq %r14, %r11
movq -0x78(%rsp), %r15
addq %r15, %rdi
movzbl -0xd(%rbx,%r12), %r14d
addq 0x40(%rsp,%r14,8), %rdi
xorq %r11, %rax
movq %rax, -0x50(%rsp)
xorq %rdi, %rbp
rorxq $0x20, %rbp, %rax
addq %rax, %r10
xorq %r10, %r15
rorxq $0x18, %r15, %r14
addq %r14, %rdi
movzbl -0xc(%rbx,%r12), %r15d
addq 0x40(%rsp,%r15,8), %rdi
xorq %rdi, %rax
rorxq $0x10, %rax, %rax
movq %rax, -0x78(%rsp)
addq %rax, %r10
xorq %r10, %r14
movq -0x70(%rsp), %r15
addq %r15, %rsi
movzbl -0xb(%rbx,%r12), %eax
movq %r12, %rbp
addq 0x40(%rsp,%rax,8), %rsi
rorxq $0x3f, %r14, %r12
movq -0x68(%rsp), %rax
xorq %rsi, %rax
rorxq $0x20, %rax, %rax
addq %rax, %r8
xorq %r8, %r15
rorxq $0x18, %r15, %r14
addq %r14, %rsi
movzbl -0xa(%rbx,%rbp), %r15d
addq 0x40(%rsp,%r15,8), %rsi
xorq %rsi, %rax
rorxq $0x10, %rax, %rax
movq %rax, -0x70(%rsp)
addq %rax, %r8
xorq %r8, %r14
movq -0x60(%rsp), %r15
addq %r15, %rdx
movzbl -0x9(%rbx,%rbp), %eax
addq 0x40(%rsp,%rax,8), %rdx
rorxq $0x3f, %r14, %rax
xorq %rdx, %r13
rorxq $0x20, %r13, %r14
addq %r14, %rcx
xorq %rcx, %r15
rorxq $0x18, %r15, %r15
addq %r15, %rdx
movzbl -0x8(%rbx,%rbp), %r13d
addq 0x40(%rsp,%r13,8), %rdx
xorq %rdx, %r14
rorxq $0x10, %r14, %r13
addq %r13, %rcx
xorq %rcx, %r15
addq %r12, %r9
movzbl -0x7(%rbx,%rbp), %r14d
addq 0x40(%rsp,%r14,8), %r9
rorxq $0x3f, %r15, %r14
xorq %r9, %r13
rorxq $0x20, %r13, %r15
movq %r15, -0x60(%rsp)
addq %r15, %r8
xorq %r8, %r12
rorxq $0x18, %r12, %r15
movq %r15, -0x68(%rsp)
addq %r15, %r9
movzbl -0x6(%rbx,%rbp), %r12d
addq 0x40(%rsp,%r12,8), %r9
addq %rax, %rdi
movzbl -0x5(%rbx,%rbp), %r12d
addq 0x40(%rsp,%r12,8), %rdi
movq -0x58(%rsp), %r15
xorq %rdi, %r15
rorxq $0x20, %r15, %r12
addq %r12, %rcx
xorq %rcx, %rax
rorxq $0x18, %rax, %rax
movq %rax, -0x58(%rsp)
addq %rax, %rdi
movzbl -0x4(%rbx,%rbp), %eax
addq 0x40(%rsp,%rax,8), %rdi
addq %r14, %rsi
movzbl -0x3(%rbx,%rbp), %eax
movq %rbp, %r15
addq 0x40(%rsp,%rax,8), %rsi
movq -0x78(%rsp), %rax
xorq %rsi, %rax
rorxq $0x20, %rax, %rbp
addq %rbp, %r11
xorq %r11, %r14
rorxq $0x18, %r14, %r14
addq %r14, %rsi
movzbl -0x2(%rbx,%r15), %r13d
addq 0x40(%rsp,%r13,8), %rsi
rorxq $0x3f, -0x50(%rsp), %r13
addq %r13, %rdx
movzbl -0x1(%rbx,%r15), %r15d
addq 0x40(%rsp,%r15,8), %rdx
movq -0x70(%rsp), %rax
xorq %rdx, %rax
rorxq $0x20, %rax, %rax
addq %rax, %r10
xorq %r10, %r13
rorxq $0x18, %r13, %r13
addq %r13, %rdx
leaq 0xc4d(%rip), %r15       # 0x4130
movzbl (%rbx,%r15), %r15d
addq 0x40(%rsp,%r15,8), %rdx
movq -0x60(%rsp), %r15
xorq %r9, %r15
rorxq $0x10, %r15, %r15
movq %r15, -0x50(%rsp)
addq %r15, %r8
movq -0x68(%rsp), %r15
xorq %r8, %r15
rorxq $0x3f, %r15, %r15
movq %r15, -0x78(%rsp)
xorq %rdi, %r12
rorxq $0x10, %r12, %r15
addq %r15, %rcx
movq -0x58(%rsp), %r12
xorq %rcx, %r12
rorxq $0x3f, %r12, %r12
movq %r12, -0x70(%rsp)
xorq %rsi, %rbp
rorxq $0x10, %rbp, %rbp
addq %rbp, %r11
xorq %r11, %r14
rorxq $0x3f, %r14, %r14
xorq %rdx, %rax
rorxq $0x10, %rax, %rax
addq %rax, %r10
xorq %r10, %r13
rorxq $0x3f, %r13, %r12
movq -0x50(%rsp), %r13
addq $0x10, %rbx
cmpq $0xcf, %rbx
jne 0x32a8
movq %r9, -0x40(%rsp)
movq %r12, -0x20(%rsp)
movq %r15, 0x20(%rsp)
movq %r11, (%rsp)
movq %rdi, -0x38(%rsp)
movq -0x78(%rsp), %rdi
movq %rdi, -0x18(%rsp)
movq %rbp, 0x28(%rsp)
movq %r10, 0x8(%rsp)
movq %rsi, -0x30(%rsp)
movq -0x70(%rsp), %rsi
movq %rsi, -0x10(%rsp)
movq %rax, 0x30(%rsp)
movq %r8, 0x10(%rsp)
movq %rdx, -0x28(%rsp)
movq %r14, -0x8(%rsp)
movq %r13, 0x38(%rsp)
movq %rcx, 0x18(%rsp)
xorl %eax, %eax
movq -0x48(%rsp), %rcx
vmovdqu (%rsp,%rax,8), %ymm0
vmovdqu (%rcx,%rax,8), %ymm1
vpternlogq $0x96, -0x40(%rsp,%rax,8), %ymm0, %ymm1
vmovdqu %ymm1, (%rcx,%rax,8)
addq $0x4, %rax
cmpq $0x8, %rax
jne 0x35d5
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq