{
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) 2012, Intel Corporation
;
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are
; met:
;
; * Redistributions of source code must retain the above copyright
;   notice, this list of conditions and the following disclaimer.
;
; * Redistributions in binary form must reproduce the above copyright
;   notice, this list of conditions and the following disclaimer in the
;   documentation and/or other materials provided with the
;   distribution.
;
; * Neither the name of the Intel Corporation nor the names of its
;   contributors may be used to endorse or promote products derived from
;   this software without specific prior written permission.
;
;
; THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This code schedules 1 blocks at a time, with 4 lanes per block
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/*
 * Conversion to GAS assembly and integration to libgcrypt
 *  by Jussi Kivilinna <jussi.kivilinna@iki.fi>
 */
}

{$CODEALIGN CONSTMIN=32}

const
  _BYTE_FLIP_MASK: array[0..3] of UInt64 = ($0001020304050607, $08090a0b0c0d0e0f,
                                            $1011121314151617, $18191a1b1c1d1e1f);
  _MASK_YMM_LO: array[0..3] of UInt64 = (UInt64($0000000000000000), UInt64($0000000000000000),
                                         UInt64($FFFFFFFFFFFFFFFF), UInt64($FFFFFFFFFFFFFFFF));

procedure sha512_compress_avx(HashBuffer: PByte; CurrentHash: PInt64; BufferCount: UIntPtr); assembler; nostackframe;
asm
.balign 16
{$IF DEFINED(WIN64)}
  movq   %rsi, 16(%rsp)
  movq   %rdi, 24(%rsp)
  subq   $88, %rsp
  movdqa %xmm6, (%rsp)
  movdqa %xmm7, 16(%rsp)
  movdqa %xmm8, 32(%rsp)
  movdqa %xmm9, 48(%rsp)
  movdqa %xmm10, 64(%rsp)
  movq   %rcx, %rdi
  movq   %rdx, %rsi
  movq   %r8,  %rdx
{$ENDIF}
  xor    %eax,%eax
  cmp    $0x0,%rdx
  je     .Lnowork
  vzeroupper
  mov    %rsp,%rax
  sub    $0xd0,%rsp
  and    $0xffffffffffffffc0,%rsp
  mov    %rax,0x98(%rsp)
  mov    %rbp,0xa0(%rsp)
  mov    %rbx,0xa8(%rsp)
  mov    %r12,0xb0(%rsp)
  mov    %r13,0xb8(%rsp)
  mov    %r14,0xc0(%rsp)
  mov    %r15,0xc8(%rsp)
  mov    %rdx,0x90(%rsp)
  mov    (%rsi),%rax
  mov    0x8(%rsi),%rbx
  mov    0x10(%rsi),%rcx
  mov    0x18(%rsi),%r8
  mov    0x20(%rsi),%rdx
  mov    0x28(%rsi),%r9
  mov    0x30(%rsi),%r10
  mov    0x38(%rsi),%r11
  vmovdqa _BYTE_FLIP_MASK(%rip),%ymm9
  vmovdqa _MASK_YMM_LO(%rip),%ymm10
  lea    .LK512(%rip),%rbp
  vmovdqu (%rdi),%ymm4
  vpshufb %ymm9,%ymm4,%ymm4
  vmovdqu 0x20(%rdi),%ymm5
  vpshufb %ymm9,%ymm5,%ymm5
  vmovdqu 0x40(%rdi),%ymm6
  vpshufb %ymm9,%ymm6,%ymm6
  vmovdqu 0x60(%rdi),%ymm7
  vpshufb %ymm9,%ymm7,%ymm7
  add    $0x80,%rdi
  mov    %rdi,0x88(%rsp)
  vpaddq 0x0(%rbp),%ymm4,%ymm0
  vmovdqa %ymm0,(%rsp)
  vpaddq 0x20(%rbp),%ymm5,%ymm0
  vmovdqa %ymm0,0x20(%rsp)
  vpaddq 0x40(%rbp),%ymm6,%ymm0
  vmovdqa %ymm0,0x40(%rsp)
  vpaddq 0x60(%rbp),%ymm7,%ymm0
  vmovdqa %ymm0,0x60(%rsp)
  movq   $0x4,0x80(%rsp)

.balign 16
.Loop0:
  vperm2i128 $0x3,%ymm6,%ymm7,%ymm0
  vpalignr $0x8,%ymm6,%ymm0,%ymm0
  vpaddq %ymm4,%ymm0,%ymm0
  vperm2i128 $0x3,%ymm4,%ymm5,%ymm1
  vpalignr $0x8,%ymm4,%ymm1,%ymm1
  vpsrlq $0x1,%ymm1,%ymm2
  vpsllq $0x3f,%ymm1,%ymm3
  vpor   %ymm2,%ymm3,%ymm3
  vpsrlq $0x7,%ymm1,%ymm8
  mov    %rdx,%rdi
  add    (%rsp),%r11
  and    %r9,%rdi
  rorx   $0x29,%rdx,%r13
  rorx   $0x12,%rdx,%r14
  lea    (%r11,%rdi,1),%r11
  andn   %r10,%rdx,%rdi
  rorx   $0x22,%rax,%r12
  xor    %r14,%r13
  lea    (%r11,%rdi,1),%r11
  rorx   $0x27,%rax,%r15
  rorx   $0xe,%rdx,%r14
  mov    %rax,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rbx,%rdi
  lea    (%r11,%r13,1),%r11
  mov    %rax,%r13
  rorx   $0x1c,%rax,%r15
  add    %r11,%r8
  and    %rcx,%rdi
  xor    %r15,%r12
  lea    (%r11,%rdi,1),%r11
  lea    (%r11,%r12,1),%r11
  and    %rbx,%r13
  lea    (%r11,%r13,1),%r11
  vpsrlq $0x8,%ymm1,%ymm2
  vpsllq $0x38,%ymm1,%ymm1
  vpor   %ymm2,%ymm1,%ymm1
  vpxor  %ymm8,%ymm3,%ymm3
  vpxor  %ymm1,%ymm3,%ymm1
  vpaddq %ymm1,%ymm0,%ymm0
  vperm2i128 $0x0,%ymm0,%ymm0,%ymm4
  vpand  %ymm10,%ymm0,%ymm0
  vperm2i128 $0x11,%ymm7,%ymm7,%ymm2
  vpsrlq $0x6,%ymm2,%ymm8
  mov    %r8,%rdi
  add    0x8(%rsp),%r10
  and    %rdx,%rdi
  rorx   $0x29,%r8,%r13
  rorx   $0x12,%r8,%r14
  lea    (%r10,%rdi,1),%r10
  andn   %r9,%r8,%rdi
  rorx   $0x22,%r11,%r12
  xor    %r14,%r13
  lea    (%r10,%rdi,1),%r10
  rorx   $0x27,%r11,%r15
  rorx   $0xe,%r8,%r14
  mov    %r11,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rax,%rdi
  lea    (%r10,%r13,1),%r10
  mov    %r11,%r13
  rorx   $0x1c,%r11,%r15
  add    %r10,%rcx
  and    %rbx,%rdi
  xor    %r15,%r12
  lea    (%r10,%rdi,1),%r10
  lea    (%r10,%r12,1),%r10
  and    %rax,%r13
  lea    (%r10,%r13,1),%r10
  vpsrlq $0x13,%ymm2,%ymm3
  vpsllq $0x2d,%ymm2,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpsrlq $0x3d,%ymm2,%ymm3
  vpsllq $0x3,%ymm2,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpaddq %ymm8,%ymm4,%ymm4
  vpsrlq $0x6,%ymm4,%ymm8
  mov    %rcx,%rdi
  add    0x10(%rsp),%r9
  and    %r8,%rdi
  rorx   $0x29,%rcx,%r13
  rorx   $0x12,%rcx,%r14
  lea    (%r9,%rdi,1),%r9
  andn   %rdx,%rcx,%rdi
  rorx   $0x22,%r10,%r12
  xor    %r14,%r13
  lea    (%r9,%rdi,1),%r9
  rorx   $0x27,%r10,%r15
  rorx   $0xe,%rcx,%r14
  mov    %r10,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r11,%rdi
  lea    (%r9,%r13,1),%r9
  mov    %r10,%r13
  rorx   $0x1c,%r10,%r15
  add    %r9,%rbx
  and    %rax,%rdi
  xor    %r15,%r12
  lea    (%r9,%rdi,1),%r9
  lea    (%r9,%r12,1),%r9
  and    %r11,%r13
  lea    (%r9,%r13,1),%r9
  vpsrlq $0x13,%ymm4,%ymm3
  vpsllq $0x2d,%ymm4,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpsrlq $0x3d,%ymm4,%ymm3
  vpsllq $0x3,%ymm4,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpaddq %ymm8,%ymm0,%ymm2
  vpblendd $0xf0,%ymm2,%ymm4,%ymm4
  mov    %rbx,%rdi
  add    0x18(%rsp),%rdx
  and    %rcx,%rdi
  rorx   $0x29,%rbx,%r13
  rorx   $0x12,%rbx,%r14
  lea    (%rdx,%rdi,1),%rdx
  andn   %r8,%rbx,%rdi
  rorx   $0x22,%r9,%r12
  xor    %r14,%r13
  lea    (%rdx,%rdi,1),%rdx
  vpaddq 0x80(%rbp),%ymm4,%ymm0
  vmovdqa %ymm0,(%rsp)
  rorx   $0x27,%r9,%r15
  rorx   $0xe,%rbx,%r14
  mov    %r9,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r10,%rdi
  lea    (%rdx,%r13,1),%rdx
  mov    %r9,%r13
  rorx   $0x1c,%r9,%r15
  add    %rdx,%rax
  and    %r11,%rdi
  xor    %r15,%r12
  lea    (%rdx,%rdi,1),%rdx
  lea    (%rdx,%r12,1),%rdx
  and    %r10,%r13
  lea    (%rdx,%r13,1),%rdx
  vperm2i128 $0x3,%ymm7,%ymm4,%ymm0
  vpalignr $0x8,%ymm7,%ymm0,%ymm0
  vpaddq %ymm5,%ymm0,%ymm0
  vperm2i128 $0x3,%ymm5,%ymm6,%ymm1
  vpalignr $0x8,%ymm5,%ymm1,%ymm1
  vpsrlq $0x1,%ymm1,%ymm2
  vpsllq $0x3f,%ymm1,%ymm3
  vpor   %ymm2,%ymm3,%ymm3
  vpsrlq $0x7,%ymm1,%ymm8
  mov    %rax,%rdi
  add    0x20(%rsp),%r8
  and    %rbx,%rdi
  rorx   $0x29,%rax,%r13
  rorx   $0x12,%rax,%r14
  lea    (%r8,%rdi,1),%r8
  andn   %rcx,%rax,%rdi
  rorx   $0x22,%rdx,%r12
  xor    %r14,%r13
  lea    (%r8,%rdi,1),%r8
  rorx   $0x27,%rdx,%r15
  rorx   $0xe,%rax,%r14
  mov    %rdx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r9,%rdi
  lea    (%r8,%r13,1),%r8
  mov    %rdx,%r13
  rorx   $0x1c,%rdx,%r15
  add    %r8,%r11
  and    %r10,%rdi
  xor    %r15,%r12
  lea    (%r8,%rdi,1),%r8
  lea    (%r8,%r12,1),%r8
  and    %r9,%r13
  lea    (%r8,%r13,1),%r8
  vpsrlq $0x8,%ymm1,%ymm2
  vpsllq $0x38,%ymm1,%ymm1
  vpor   %ymm2,%ymm1,%ymm1
  vpxor  %ymm8,%ymm3,%ymm3
  vpxor  %ymm1,%ymm3,%ymm1
  vpaddq %ymm1,%ymm0,%ymm0
  vperm2i128 $0x0,%ymm0,%ymm0,%ymm5
  vpand  %ymm10,%ymm0,%ymm0
  vperm2i128 $0x11,%ymm4,%ymm4,%ymm2
  vpsrlq $0x6,%ymm2,%ymm8
  mov    %r11,%rdi
  add    0x28(%rsp),%rcx
  and    %rax,%rdi
  rorx   $0x29,%r11,%r13
  rorx   $0x12,%r11,%r14
  lea    (%rcx,%rdi,1),%rcx
  andn   %rbx,%r11,%rdi
  rorx   $0x22,%r8,%r12
  xor    %r14,%r13
  lea    (%rcx,%rdi,1),%rcx
  rorx   $0x27,%r8,%r15
  rorx   $0xe,%r11,%r14
  mov    %r8,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rdx,%rdi
  lea    (%rcx,%r13,1),%rcx
  mov    %r8,%r13
  rorx   $0x1c,%r8,%r15
  add    %rcx,%r10
  and    %r9,%rdi
  xor    %r15,%r12
  lea    (%rcx,%rdi,1),%rcx
  lea    (%rcx,%r12,1),%rcx
  and    %rdx,%r13
  lea    (%rcx,%r13,1),%rcx
  vpsrlq $0x13,%ymm2,%ymm3
  vpsllq $0x2d,%ymm2,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpsrlq $0x3d,%ymm2,%ymm3
  vpsllq $0x3,%ymm2,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpaddq %ymm8,%ymm5,%ymm5
  vpsrlq $0x6,%ymm5,%ymm8
  mov    %r10,%rdi
  add    0x30(%rsp),%rbx
  and    %r11,%rdi
  rorx   $0x29,%r10,%r13
  rorx   $0x12,%r10,%r14
  lea    (%rbx,%rdi,1),%rbx
  andn   %rax,%r10,%rdi
  rorx   $0x22,%rcx,%r12
  xor    %r14,%r13
  lea    (%rbx,%rdi,1),%rbx
  rorx   $0x27,%rcx,%r15
  rorx   $0xe,%r10,%r14
  mov    %rcx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r8,%rdi
  lea    (%rbx,%r13,1),%rbx
  mov    %rcx,%r13
  rorx   $0x1c,%rcx,%r15
  add    %rbx,%r9
  and    %rdx,%rdi
  xor    %r15,%r12
  lea    (%rbx,%rdi,1),%rbx
  lea    (%rbx,%r12,1),%rbx
  and    %r8,%r13
  lea    (%rbx,%r13,1),%rbx
  vpsrlq $0x13,%ymm5,%ymm3
  vpsllq $0x2d,%ymm5,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpsrlq $0x3d,%ymm5,%ymm3
  vpsllq $0x3,%ymm5,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpaddq %ymm8,%ymm0,%ymm2
  vpblendd $0xf0,%ymm2,%ymm5,%ymm5
  mov    %r9,%rdi
  add    0x38(%rsp),%rax
  and    %r10,%rdi
  rorx   $0x29,%r9,%r13
  rorx   $0x12,%r9,%r14
  lea    (%rax,%rdi,1),%rax
  andn   %r11,%r9,%rdi
  rorx   $0x22,%rbx,%r12
  xor    %r14,%r13
  lea    (%rax,%rdi,1),%rax
  vpaddq 0xa0(%rbp),%ymm5,%ymm0
  vmovdqa %ymm0,0x20(%rsp)
  rorx   $0x27,%rbx,%r15
  rorx   $0xe,%r9,%r14
  mov    %rbx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rcx,%rdi
  lea    (%rax,%r13,1),%rax
  mov    %rbx,%r13
  rorx   $0x1c,%rbx,%r15
  add    %rax,%rdx
  and    %r8,%rdi
  xor    %r15,%r12
  lea    (%rax,%rdi,1),%rax
  lea    (%rax,%r12,1),%rax
  and    %rcx,%r13
  lea    (%rax,%r13,1),%rax
  vperm2i128 $0x3,%ymm4,%ymm5,%ymm0
  vpalignr $0x8,%ymm4,%ymm0,%ymm0
  vpaddq %ymm6,%ymm0,%ymm0
  vperm2i128 $0x3,%ymm6,%ymm7,%ymm1
  vpalignr $0x8,%ymm6,%ymm1,%ymm1
  vpsrlq $0x1,%ymm1,%ymm2
  vpsllq $0x3f,%ymm1,%ymm3
  vpor   %ymm2,%ymm3,%ymm3
  vpsrlq $0x7,%ymm1,%ymm8
  mov    %rdx,%rdi
  add    0x40(%rsp),%r11
  and    %r9,%rdi
  rorx   $0x29,%rdx,%r13
  rorx   $0x12,%rdx,%r14
  lea    (%r11,%rdi,1),%r11
  andn   %r10,%rdx,%rdi
  rorx   $0x22,%rax,%r12
  xor    %r14,%r13
  lea    (%r11,%rdi,1),%r11
  rorx   $0x27,%rax,%r15
  rorx   $0xe,%rdx,%r14
  mov    %rax,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rbx,%rdi
  lea    (%r11,%r13,1),%r11
  mov    %rax,%r13
  rorx   $0x1c,%rax,%r15
  add    %r11,%r8
  and    %rcx,%rdi
  xor    %r15,%r12
  lea    (%r11,%rdi,1),%r11
  lea    (%r11,%r12,1),%r11
  and    %rbx,%r13
  lea    (%r11,%r13,1),%r11
  vpsrlq $0x8,%ymm1,%ymm2
  vpsllq $0x38,%ymm1,%ymm1
  vpor   %ymm2,%ymm1,%ymm1
  vpxor  %ymm8,%ymm3,%ymm3
  vpxor  %ymm1,%ymm3,%ymm1
  vpaddq %ymm1,%ymm0,%ymm0
  vperm2i128 $0x0,%ymm0,%ymm0,%ymm6
  vpand  %ymm10,%ymm0,%ymm0
  vperm2i128 $0x11,%ymm5,%ymm5,%ymm2
  vpsrlq $0x6,%ymm2,%ymm8
  mov    %r8,%rdi
  add    0x48(%rsp),%r10
  and    %rdx,%rdi
  rorx   $0x29,%r8,%r13
  rorx   $0x12,%r8,%r14
  lea    (%r10,%rdi,1),%r10
  andn   %r9,%r8,%rdi
  rorx   $0x22,%r11,%r12
  xor    %r14,%r13
  lea    (%r10,%rdi,1),%r10
  rorx   $0x27,%r11,%r15
  rorx   $0xe,%r8,%r14
  mov    %r11,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rax,%rdi
  lea    (%r10,%r13,1),%r10
  mov    %r11,%r13
  rorx   $0x1c,%r11,%r15
  add    %r10,%rcx
  and    %rbx,%rdi
  xor    %r15,%r12
  lea    (%r10,%rdi,1),%r10
  lea    (%r10,%r12,1),%r10
  and    %rax,%r13
  lea    (%r10,%r13,1),%r10
  vpsrlq $0x13,%ymm2,%ymm3
  vpsllq $0x2d,%ymm2,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpsrlq $0x3d,%ymm2,%ymm3
  vpsllq $0x3,%ymm2,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpaddq %ymm8,%ymm6,%ymm6
  vpsrlq $0x6,%ymm6,%ymm8
  mov    %rcx,%rdi
  add    0x50(%rsp),%r9
  and    %r8,%rdi
  rorx   $0x29,%rcx,%r13
  rorx   $0x12,%rcx,%r14
  lea    (%r9,%rdi,1),%r9
  andn   %rdx,%rcx,%rdi
  rorx   $0x22,%r10,%r12
  xor    %r14,%r13
  lea    (%r9,%rdi,1),%r9
  rorx   $0x27,%r10,%r15
  rorx   $0xe,%rcx,%r14
  mov    %r10,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r11,%rdi
  lea    (%r9,%r13,1),%r9
  mov    %r10,%r13
  rorx   $0x1c,%r10,%r15
  add    %r9,%rbx
  and    %rax,%rdi
  xor    %r15,%r12
  lea    (%r9,%rdi,1),%r9
  lea    (%r9,%r12,1),%r9
  and    %r11,%r13
  lea    (%r9,%r13,1),%r9
  vpsrlq $0x13,%ymm6,%ymm3
  vpsllq $0x2d,%ymm6,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpsrlq $0x3d,%ymm6,%ymm3
  vpsllq $0x3,%ymm6,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpaddq %ymm8,%ymm0,%ymm2
  vpblendd $0xf0,%ymm2,%ymm6,%ymm6
  mov    %rbx,%rdi
  add    0x58(%rsp),%rdx
  and    %rcx,%rdi
  rorx   $0x29,%rbx,%r13
  rorx   $0x12,%rbx,%r14
  lea    (%rdx,%rdi,1),%rdx
  andn   %r8,%rbx,%rdi
  rorx   $0x22,%r9,%r12
  xor    %r14,%r13
  lea    (%rdx,%rdi,1),%rdx
  vpaddq 0xc0(%rbp),%ymm6,%ymm0
  vmovdqa %ymm0,0x40(%rsp)
  rorx   $0x27,%r9,%r15
  rorx   $0xe,%rbx,%r14
  mov    %r9,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r10,%rdi
  lea    (%rdx,%r13,1),%rdx
  mov    %r9,%r13
  rorx   $0x1c,%r9,%r15
  add    %rdx,%rax
  and    %r11,%rdi
  xor    %r15,%r12
  lea    (%rdx,%rdi,1),%rdx
  lea    (%rdx,%r12,1),%rdx
  and    %r10,%r13
  lea    (%rdx,%r13,1),%rdx
  vperm2i128 $0x3,%ymm5,%ymm6,%ymm0
  vpalignr $0x8,%ymm5,%ymm0,%ymm0
  vpaddq %ymm7,%ymm0,%ymm0
  vperm2i128 $0x3,%ymm7,%ymm4,%ymm1
  vpalignr $0x8,%ymm7,%ymm1,%ymm1
  vpsrlq $0x1,%ymm1,%ymm2
  vpsllq $0x3f,%ymm1,%ymm3
  vpor   %ymm2,%ymm3,%ymm3
  vpsrlq $0x7,%ymm1,%ymm8
  mov    %rax,%rdi
  add    0x60(%rsp),%r8
  and    %rbx,%rdi
  rorx   $0x29,%rax,%r13
  rorx   $0x12,%rax,%r14
  lea    (%r8,%rdi,1),%r8
  andn   %rcx,%rax,%rdi
  rorx   $0x22,%rdx,%r12
  xor    %r14,%r13
  lea    (%r8,%rdi,1),%r8
  rorx   $0x27,%rdx,%r15
  rorx   $0xe,%rax,%r14
  mov    %rdx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r9,%rdi
  lea    (%r8,%r13,1),%r8
  mov    %rdx,%r13
  rorx   $0x1c,%rdx,%r15
  add    %r8,%r11
  and    %r10,%rdi
  xor    %r15,%r12
  lea    (%r8,%rdi,1),%r8
  lea    (%r8,%r12,1),%r8
  and    %r9,%r13
  lea    (%r8,%r13,1),%r8
  vpsrlq $0x8,%ymm1,%ymm2
  vpsllq $0x38,%ymm1,%ymm1
  vpor   %ymm2,%ymm1,%ymm1
  vpxor  %ymm8,%ymm3,%ymm3
  vpxor  %ymm1,%ymm3,%ymm1
  vpaddq %ymm1,%ymm0,%ymm0
  vperm2i128 $0x0,%ymm0,%ymm0,%ymm7
  vpand  %ymm10,%ymm0,%ymm0
  vperm2i128 $0x11,%ymm6,%ymm6,%ymm2
  vpsrlq $0x6,%ymm2,%ymm8
  mov    %r11,%rdi
  add    0x68(%rsp),%rcx
  and    %rax,%rdi
  rorx   $0x29,%r11,%r13
  rorx   $0x12,%r11,%r14
  lea    (%rcx,%rdi,1),%rcx
  andn   %rbx,%r11,%rdi
  rorx   $0x22,%r8,%r12
  xor    %r14,%r13
  lea    (%rcx,%rdi,1),%rcx
  rorx   $0x27,%r8,%r15
  rorx   $0xe,%r11,%r14
  mov    %r8,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rdx,%rdi
  lea    (%rcx,%r13,1),%rcx
  mov    %r8,%r13
  rorx   $0x1c,%r8,%r15
  add    %rcx,%r10
  and    %r9,%rdi
  xor    %r15,%r12
  lea    (%rcx,%rdi,1),%rcx
  lea    (%rcx,%r12,1),%rcx
  and    %rdx,%r13
  lea    (%rcx,%r13,1),%rcx
  vpsrlq $0x13,%ymm2,%ymm3
  vpsllq $0x2d,%ymm2,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpsrlq $0x3d,%ymm2,%ymm3
  vpsllq $0x3,%ymm2,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpaddq %ymm8,%ymm7,%ymm7
  vpsrlq $0x6,%ymm7,%ymm8
  mov    %r10,%rdi
  add    0x70(%rsp),%rbx
  and    %r11,%rdi
  rorx   $0x29,%r10,%r13
  rorx   $0x12,%r10,%r14
  lea    (%rbx,%rdi,1),%rbx
  andn   %rax,%r10,%rdi
  rorx   $0x22,%rcx,%r12
  xor    %r14,%r13
  lea    (%rbx,%rdi,1),%rbx
  rorx   $0x27,%rcx,%r15
  rorx   $0xe,%r10,%r14
  mov    %rcx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r8,%rdi
  lea    (%rbx,%r13,1),%rbx
  mov    %rcx,%r13
  rorx   $0x1c,%rcx,%r15
  add    %rbx,%r9
  and    %rdx,%rdi
  xor    %r15,%r12
  lea    (%rbx,%rdi,1),%rbx
  lea    (%rbx,%r12,1),%rbx
  and    %r8,%r13
  lea    (%rbx,%r13,1),%rbx
  vpsrlq $0x13,%ymm7,%ymm3
  vpsllq $0x2d,%ymm7,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpsrlq $0x3d,%ymm7,%ymm3
  vpsllq $0x3,%ymm7,%ymm1
  vpor   %ymm1,%ymm3,%ymm3
  vpxor  %ymm3,%ymm8,%ymm8
  vpaddq %ymm8,%ymm0,%ymm2
  vpblendd $0xf0,%ymm2,%ymm7,%ymm7
  mov    %r9,%rdi
  add    0x78(%rsp),%rax
  and    %r10,%rdi
  rorx   $0x29,%r9,%r13
  rorx   $0x12,%r9,%r14
  lea    (%rax,%rdi,1),%rax
  andn   %r11,%r9,%rdi
  rorx   $0x22,%rbx,%r12
  xor    %r14,%r13
  lea    (%rax,%rdi,1),%rax
  vpaddq 0xe0(%rbp),%ymm7,%ymm0
  vmovdqa %ymm0,0x60(%rsp)
  rorx   $0x27,%rbx,%r15
  rorx   $0xe,%r9,%r14
  mov    %rbx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rcx,%rdi
  lea    (%rax,%r13,1),%rax
  mov    %rbx,%r13
  rorx   $0x1c,%rbx,%r15
  add    %rax,%rdx
  and    %r8,%rdi
  xor    %r15,%r12
  lea    (%rax,%rdi,1),%rax
  lea    (%rax,%r12,1),%rax
  and    %rcx,%r13
  lea    (%rax,%r13,1),%rax
  add    $0x80,%rbp
  subq   $0x1,0x80(%rsp)
  jne    .Loop0
  subq   $0x1,0x90(%rsp)
  je     .Ldone_hash
  mov    0x88(%rsp),%rdi
  lea    .LK512(%rip),%rbp
  vmovdqu (%rdi),%ymm4
  vpshufb %ymm9,%ymm4,%ymm4
  vmovdqu 0x20(%rdi),%ymm5
  vpshufb %ymm9,%ymm5,%ymm5
  vmovdqu 0x40(%rdi),%ymm6
  vpshufb %ymm9,%ymm6,%ymm6
  vmovdqu 0x60(%rdi),%ymm7
  vpshufb %ymm9,%ymm7,%ymm7
  add    $0x80,%rdi
  mov    %rdi,0x88(%rsp)
  mov    %rdx,%rdi
  add    (%rsp),%r11
  and    %r9,%rdi
  rorx   $0x29,%rdx,%r13
  rorx   $0x12,%rdx,%r14
  lea    (%r11,%rdi,1),%r11
  andn   %r10,%rdx,%rdi
  rorx   $0x22,%rax,%r12
  xor    %r14,%r13
  lea    (%r11,%rdi,1),%r11
  rorx   $0x27,%rax,%r15
  rorx   $0xe,%rdx,%r14
  mov    %rax,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rbx,%rdi
  lea    (%r11,%r13,1),%r11
  mov    %rax,%r13
  rorx   $0x1c,%rax,%r15
  add    %r11,%r8
  and    %rcx,%rdi
  xor    %r15,%r12
  lea    (%r11,%rdi,1),%r11
  lea    (%r11,%r12,1),%r11
  and    %rbx,%r13
  lea    (%r11,%r13,1),%r11
  mov    %r8,%rdi
  add    0x8(%rsp),%r10
  and    %rdx,%rdi
  rorx   $0x29,%r8,%r13
  rorx   $0x12,%r8,%r14
  lea    (%r10,%rdi,1),%r10
  andn   %r9,%r8,%rdi
  rorx   $0x22,%r11,%r12
  xor    %r14,%r13
  lea    (%r10,%rdi,1),%r10
  rorx   $0x27,%r11,%r15
  rorx   $0xe,%r8,%r14
  mov    %r11,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rax,%rdi
  lea    (%r10,%r13,1),%r10
  mov    %r11,%r13
  rorx   $0x1c,%r11,%r15
  add    %r10,%rcx
  and    %rbx,%rdi
  xor    %r15,%r12
  lea    (%r10,%rdi,1),%r10
  lea    (%r10,%r12,1),%r10
  and    %rax,%r13
  lea    (%r10,%r13,1),%r10
  mov    %rcx,%rdi
  add    0x10(%rsp),%r9
  and    %r8,%rdi
  rorx   $0x29,%rcx,%r13
  rorx   $0x12,%rcx,%r14
  lea    (%r9,%rdi,1),%r9
  andn   %rdx,%rcx,%rdi
  rorx   $0x22,%r10,%r12
  xor    %r14,%r13
  lea    (%r9,%rdi,1),%r9
  rorx   $0x27,%r10,%r15
  rorx   $0xe,%rcx,%r14
  mov    %r10,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r11,%rdi
  lea    (%r9,%r13,1),%r9
  mov    %r10,%r13
  rorx   $0x1c,%r10,%r15
  add    %r9,%rbx
  and    %rax,%rdi
  xor    %r15,%r12
  lea    (%r9,%rdi,1),%r9
  lea    (%r9,%r12,1),%r9
  and    %r11,%r13
  lea    (%r9,%r13,1),%r9
  mov    %rbx,%rdi
  add    0x18(%rsp),%rdx
  and    %rcx,%rdi
  rorx   $0x29,%rbx,%r13
  rorx   $0x12,%rbx,%r14
  lea    (%rdx,%rdi,1),%rdx
  andn   %r8,%rbx,%rdi
  rorx   $0x22,%r9,%r12
  xor    %r14,%r13
  lea    (%rdx,%rdi,1),%rdx
  rorx   $0x27,%r9,%r15
  rorx   $0xe,%rbx,%r14
  mov    %r9,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r10,%rdi
  lea    (%rdx,%r13,1),%rdx
  mov    %r9,%r13
  rorx   $0x1c,%r9,%r15
  add    %rdx,%rax
  and    %r11,%rdi
  xor    %r15,%r12
  lea    (%rdx,%rdi,1),%rdx
  lea    (%rdx,%r12,1),%rdx
  and    %r10,%r13
  lea    (%rdx,%r13,1),%rdx
  vpaddq 0x0(%rbp),%ymm4,%ymm0
  vmovdqa %ymm0,(%rsp)
  mov    %rax,%rdi
  add    0x20(%rsp),%r8
  and    %rbx,%rdi
  rorx   $0x29,%rax,%r13
  rorx   $0x12,%rax,%r14
  lea    (%r8,%rdi,1),%r8
  andn   %rcx,%rax,%rdi
  rorx   $0x22,%rdx,%r12
  xor    %r14,%r13
  lea    (%r8,%rdi,1),%r8
  rorx   $0x27,%rdx,%r15
  rorx   $0xe,%rax,%r14
  mov    %rdx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r9,%rdi
  lea    (%r8,%r13,1),%r8
  mov    %rdx,%r13
  rorx   $0x1c,%rdx,%r15
  add    %r8,%r11
  and    %r10,%rdi
  xor    %r15,%r12
  lea    (%r8,%rdi,1),%r8
  lea    (%r8,%r12,1),%r8
  and    %r9,%r13
  lea    (%r8,%r13,1),%r8
  mov    %r11,%rdi
  add    0x28(%rsp),%rcx
  and    %rax,%rdi
  rorx   $0x29,%r11,%r13
  rorx   $0x12,%r11,%r14
  lea    (%rcx,%rdi,1),%rcx
  andn   %rbx,%r11,%rdi
  rorx   $0x22,%r8,%r12
  xor    %r14,%r13
  lea    (%rcx,%rdi,1),%rcx
  rorx   $0x27,%r8,%r15
  rorx   $0xe,%r11,%r14
  mov    %r8,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rdx,%rdi
  lea    (%rcx,%r13,1),%rcx
  mov    %r8,%r13
  rorx   $0x1c,%r8,%r15
  add    %rcx,%r10
  and    %r9,%rdi
  xor    %r15,%r12
  lea    (%rcx,%rdi,1),%rcx
  lea    (%rcx,%r12,1),%rcx
  and    %rdx,%r13
  lea    (%rcx,%r13,1),%rcx
  mov    %r10,%rdi
  add    0x30(%rsp),%rbx
  and    %r11,%rdi
  rorx   $0x29,%r10,%r13
  rorx   $0x12,%r10,%r14
  lea    (%rbx,%rdi,1),%rbx
  andn   %rax,%r10,%rdi
  rorx   $0x22,%rcx,%r12
  xor    %r14,%r13
  lea    (%rbx,%rdi,1),%rbx
  rorx   $0x27,%rcx,%r15
  rorx   $0xe,%r10,%r14
  mov    %rcx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r8,%rdi
  lea    (%rbx,%r13,1),%rbx
  mov    %rcx,%r13
  rorx   $0x1c,%rcx,%r15
  add    %rbx,%r9
  and    %rdx,%rdi
  xor    %r15,%r12
  lea    (%rbx,%rdi,1),%rbx
  lea    (%rbx,%r12,1),%rbx
  and    %r8,%r13
  lea    (%rbx,%r13,1),%rbx
  mov    %r9,%rdi
  add    0x38(%rsp),%rax
  and    %r10,%rdi
  rorx   $0x29,%r9,%r13
  rorx   $0x12,%r9,%r14
  lea    (%rax,%rdi,1),%rax
  andn   %r11,%r9,%rdi
  rorx   $0x22,%rbx,%r12
  xor    %r14,%r13
  lea    (%rax,%rdi,1),%rax
  rorx   $0x27,%rbx,%r15
  rorx   $0xe,%r9,%r14
  mov    %rbx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rcx,%rdi
  lea    (%rax,%r13,1),%rax
  mov    %rbx,%r13
  rorx   $0x1c,%rbx,%r15
  add    %rax,%rdx
  and    %r8,%rdi
  xor    %r15,%r12
  lea    (%rax,%rdi,1),%rax
  lea    (%rax,%r12,1),%rax
  and    %rcx,%r13
  lea    (%rax,%r13,1),%rax
  vpaddq 0x20(%rbp),%ymm5,%ymm0
  vmovdqa %ymm0,0x20(%rsp)
  mov    %rdx,%rdi
  add    0x40(%rsp),%r11
  and    %r9,%rdi
  rorx   $0x29,%rdx,%r13
  rorx   $0x12,%rdx,%r14
  lea    (%r11,%rdi,1),%r11
  andn   %r10,%rdx,%rdi
  rorx   $0x22,%rax,%r12
  xor    %r14,%r13
  lea    (%r11,%rdi,1),%r11
  rorx   $0x27,%rax,%r15
  rorx   $0xe,%rdx,%r14
  mov    %rax,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rbx,%rdi
  lea    (%r11,%r13,1),%r11
  mov    %rax,%r13
  rorx   $0x1c,%rax,%r15
  add    %r11,%r8
  and    %rcx,%rdi
  xor    %r15,%r12
  lea    (%r11,%rdi,1),%r11
  lea    (%r11,%r12,1),%r11
  and    %rbx,%r13
  lea    (%r11,%r13,1),%r11
  mov    %r8,%rdi
  add    0x48(%rsp),%r10
  and    %rdx,%rdi
  rorx   $0x29,%r8,%r13
  rorx   $0x12,%r8,%r14
  lea    (%r10,%rdi,1),%r10
  andn   %r9,%r8,%rdi
  rorx   $0x22,%r11,%r12
  xor    %r14,%r13
  lea    (%r10,%rdi,1),%r10
  rorx   $0x27,%r11,%r15
  rorx   $0xe,%r8,%r14
  mov    %r11,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rax,%rdi
  lea    (%r10,%r13,1),%r10
  mov    %r11,%r13
  rorx   $0x1c,%r11,%r15
  add    %r10,%rcx
  and    %rbx,%rdi
  xor    %r15,%r12
  lea    (%r10,%rdi,1),%r10
  lea    (%r10,%r12,1),%r10
  and    %rax,%r13
  lea    (%r10,%r13,1),%r10
  mov    %rcx,%rdi
  add    0x50(%rsp),%r9
  and    %r8,%rdi
  rorx   $0x29,%rcx,%r13
  rorx   $0x12,%rcx,%r14
  lea    (%r9,%rdi,1),%r9
  andn   %rdx,%rcx,%rdi
  rorx   $0x22,%r10,%r12
  xor    %r14,%r13
  lea    (%r9,%rdi,1),%r9
  rorx   $0x27,%r10,%r15
  rorx   $0xe,%rcx,%r14
  mov    %r10,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r11,%rdi
  lea    (%r9,%r13,1),%r9
  mov    %r10,%r13
  rorx   $0x1c,%r10,%r15
  add    %r9,%rbx
  and    %rax,%rdi
  xor    %r15,%r12
  lea    (%r9,%rdi,1),%r9
  lea    (%r9,%r12,1),%r9
  and    %r11,%r13
  lea    (%r9,%r13,1),%r9
  mov    %rbx,%rdi
  add    0x58(%rsp),%rdx
  and    %rcx,%rdi
  rorx   $0x29,%rbx,%r13
  rorx   $0x12,%rbx,%r14
  lea    (%rdx,%rdi,1),%rdx
  andn   %r8,%rbx,%rdi
  rorx   $0x22,%r9,%r12
  xor    %r14,%r13
  lea    (%rdx,%rdi,1),%rdx
  rorx   $0x27,%r9,%r15
  rorx   $0xe,%rbx,%r14
  mov    %r9,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r10,%rdi
  lea    (%rdx,%r13,1),%rdx
  mov    %r9,%r13
  rorx   $0x1c,%r9,%r15
  add    %rdx,%rax
  and    %r11,%rdi
  xor    %r15,%r12
  lea    (%rdx,%rdi,1),%rdx
  lea    (%rdx,%r12,1),%rdx
  and    %r10,%r13
  lea    (%rdx,%r13,1),%rdx
  vpaddq 0x40(%rbp),%ymm6,%ymm0
  vmovdqa %ymm0,0x40(%rsp)
  mov    %rax,%rdi
  add    0x60(%rsp),%r8
  and    %rbx,%rdi
  rorx   $0x29,%rax,%r13
  rorx   $0x12,%rax,%r14
  lea    (%r8,%rdi,1),%r8
  andn   %rcx,%rax,%rdi
  rorx   $0x22,%rdx,%r12
  xor    %r14,%r13
  lea    (%r8,%rdi,1),%r8
  rorx   $0x27,%rdx,%r15
  rorx   $0xe,%rax,%r14
  mov    %rdx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r9,%rdi
  lea    (%r8,%r13,1),%r8
  mov    %rdx,%r13
  rorx   $0x1c,%rdx,%r15
  add    %r8,%r11
  and    %r10,%rdi
  xor    %r15,%r12
  lea    (%r8,%rdi,1),%r8
  lea    (%r8,%r12,1),%r8
  and    %r9,%r13
  lea    (%r8,%r13,1),%r8
  mov    %r11,%rdi
  add    0x68(%rsp),%rcx
  and    %rax,%rdi
  rorx   $0x29,%r11,%r13
  rorx   $0x12,%r11,%r14
  lea    (%rcx,%rdi,1),%rcx
  andn   %rbx,%r11,%rdi
  rorx   $0x22,%r8,%r12
  xor    %r14,%r13
  lea    (%rcx,%rdi,1),%rcx
  rorx   $0x27,%r8,%r15
  rorx   $0xe,%r11,%r14
  mov    %r8,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rdx,%rdi
  lea    (%rcx,%r13,1),%rcx
  mov    %r8,%r13
  rorx   $0x1c,%r8,%r15
  add    %rcx,%r10
  and    %r9,%rdi
  xor    %r15,%r12
  lea    (%rcx,%rdi,1),%rcx
  lea    (%rcx,%r12,1),%rcx
  and    %rdx,%r13
  lea    (%rcx,%r13,1),%rcx
  mov    %r10,%rdi
  add    0x70(%rsp),%rbx
  and    %r11,%rdi
  rorx   $0x29,%r10,%r13
  rorx   $0x12,%r10,%r14
  lea    (%rbx,%rdi,1),%rbx
  andn   %rax,%r10,%rdi
  rorx   $0x22,%rcx,%r12
  xor    %r14,%r13
  lea    (%rbx,%rdi,1),%rbx
  rorx   $0x27,%rcx,%r15
  rorx   $0xe,%r10,%r14
  mov    %rcx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r8,%rdi
  lea    (%rbx,%r13,1),%rbx
  mov    %rcx,%r13
  rorx   $0x1c,%rcx,%r15
  add    %rbx,%r9
  and    %rdx,%rdi
  xor    %r15,%r12
  lea    (%rbx,%rdi,1),%rbx
  lea    (%rbx,%r12,1),%rbx
  and    %r8,%r13
  lea    (%rbx,%r13,1),%rbx
  mov    %r9,%rdi
  add    0x78(%rsp),%rax
  and    %r10,%rdi
  rorx   $0x29,%r9,%r13
  rorx   $0x12,%r9,%r14
  lea    (%rax,%rdi,1),%rax
  andn   %r11,%r9,%rdi
  rorx   $0x22,%rbx,%r12
  xor    %r14,%r13
  lea    (%rax,%rdi,1),%rax
  rorx   $0x27,%rbx,%r15
  rorx   $0xe,%r9,%r14
  mov    %rbx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rcx,%rdi
  lea    (%rax,%r13,1),%rax
  mov    %rbx,%r13
  rorx   $0x1c,%rbx,%r15
  add    %rax,%rdx
  and    %r8,%rdi
  xor    %r15,%r12
  lea    (%rax,%rdi,1),%rax
  lea    (%rax,%r12,1),%rax
  and    %rcx,%r13
  lea    (%rax,%r13,1),%rax
  vpaddq 0x60(%rbp),%ymm7,%ymm0
  vmovdqa %ymm0,0x60(%rsp)
  add    (%rsi),%rax
  mov    %rax,(%rsi)
  add    0x8(%rsi),%rbx
  mov    %rbx,0x8(%rsi)
  add    0x10(%rsi),%rcx
  mov    %rcx,0x10(%rsi)
  add    0x18(%rsi),%r8
  mov    %r8,0x18(%rsi)
  add    0x20(%rsi),%rdx
  mov    %rdx,0x20(%rsi)
  add    0x28(%rsi),%r9
  mov    %r9,0x28(%rsi)
  add    0x30(%rsi),%r10
  mov    %r10,0x30(%rsi)
  add    0x38(%rsi),%r11
  mov    %r11,0x38(%rsi)
  movq   $0x4,0x80(%rsp)
  jmp    .Loop0

.Ldone_hash:
  vzeroall
  mov    %rdx,%rdi
  add    (%rsp),%r11
  and    %r9,%rdi
  rorx   $0x29,%rdx,%r13
  rorx   $0x12,%rdx,%r14
  lea    (%r11,%rdi,1),%r11
  andn   %r10,%rdx,%rdi
  rorx   $0x22,%rax,%r12
  xor    %r14,%r13
  lea    (%r11,%rdi,1),%r11
  rorx   $0x27,%rax,%r15
  rorx   $0xe,%rdx,%r14
  mov    %rax,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rbx,%rdi
  lea    (%r11,%r13,1),%r11
  mov    %rax,%r13
  rorx   $0x1c,%rax,%r15
  add    %r11,%r8
  and    %rcx,%rdi
  xor    %r15,%r12
  lea    (%r11,%rdi,1),%r11
  lea    (%r11,%r12,1),%r11
  and    %rbx,%r13
  lea    (%r11,%r13,1),%r11
  mov    %r8,%rdi
  add    0x8(%rsp),%r10
  and    %rdx,%rdi
  rorx   $0x29,%r8,%r13
  rorx   $0x12,%r8,%r14
  lea    (%r10,%rdi,1),%r10
  andn   %r9,%r8,%rdi
  rorx   $0x22,%r11,%r12
  xor    %r14,%r13
  lea    (%r10,%rdi,1),%r10
  rorx   $0x27,%r11,%r15
  rorx   $0xe,%r8,%r14
  mov    %r11,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rax,%rdi
  lea    (%r10,%r13,1),%r10
  mov    %r11,%r13
  rorx   $0x1c,%r11,%r15
  add    %r10,%rcx
  and    %rbx,%rdi
  xor    %r15,%r12
  lea    (%r10,%rdi,1),%r10
  lea    (%r10,%r12,1),%r10
  and    %rax,%r13
  lea    (%r10,%r13,1),%r10
  mov    %rcx,%rdi
  add    0x10(%rsp),%r9
  and    %r8,%rdi
  rorx   $0x29,%rcx,%r13
  rorx   $0x12,%rcx,%r14
  lea    (%r9,%rdi,1),%r9
  andn   %rdx,%rcx,%rdi
  rorx   $0x22,%r10,%r12
  xor    %r14,%r13
  lea    (%r9,%rdi,1),%r9
  rorx   $0x27,%r10,%r15
  rorx   $0xe,%rcx,%r14
  mov    %r10,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r11,%rdi
  lea    (%r9,%r13,1),%r9
  mov    %r10,%r13
  rorx   $0x1c,%r10,%r15
  add    %r9,%rbx
  and    %rax,%rdi
  xor    %r15,%r12
  lea    (%r9,%rdi,1),%r9
  lea    (%r9,%r12,1),%r9
  and    %r11,%r13
  lea    (%r9,%r13,1),%r9
  mov    %rbx,%rdi
  add    0x18(%rsp),%rdx
  and    %rcx,%rdi
  rorx   $0x29,%rbx,%r13
  rorx   $0x12,%rbx,%r14
  lea    (%rdx,%rdi,1),%rdx
  andn   %r8,%rbx,%rdi
  rorx   $0x22,%r9,%r12
  xor    %r14,%r13
  lea    (%rdx,%rdi,1),%rdx
  rorx   $0x27,%r9,%r15
  rorx   $0xe,%rbx,%r14
  mov    %r9,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r10,%rdi
  lea    (%rdx,%r13,1),%rdx
  mov    %r9,%r13
  rorx   $0x1c,%r9,%r15
  add    %rdx,%rax
  and    %r11,%rdi
  xor    %r15,%r12
  lea    (%rdx,%rdi,1),%rdx
  lea    (%rdx,%r12,1),%rdx
  and    %r10,%r13
  lea    (%rdx,%r13,1),%rdx
  vmovdqa %ymm0,(%rsp)
  mov    %rax,%rdi
  add    0x20(%rsp),%r8
  and    %rbx,%rdi
  rorx   $0x29,%rax,%r13
  rorx   $0x12,%rax,%r14
  lea    (%r8,%rdi,1),%r8
  andn   %rcx,%rax,%rdi
  rorx   $0x22,%rdx,%r12
  xor    %r14,%r13
  lea    (%r8,%rdi,1),%r8
  rorx   $0x27,%rdx,%r15
  rorx   $0xe,%rax,%r14
  mov    %rdx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r9,%rdi
  lea    (%r8,%r13,1),%r8
  mov    %rdx,%r13
  rorx   $0x1c,%rdx,%r15
  add    %r8,%r11
  and    %r10,%rdi
  xor    %r15,%r12
  lea    (%r8,%rdi,1),%r8
  lea    (%r8,%r12,1),%r8
  and    %r9,%r13
  lea    (%r8,%r13,1),%r8
  mov    %r11,%rdi
  add    0x28(%rsp),%rcx
  and    %rax,%rdi
  rorx   $0x29,%r11,%r13
  rorx   $0x12,%r11,%r14
  lea    (%rcx,%rdi,1),%rcx
  andn   %rbx,%r11,%rdi
  rorx   $0x22,%r8,%r12
  xor    %r14,%r13
  lea    (%rcx,%rdi,1),%rcx
  rorx   $0x27,%r8,%r15
  rorx   $0xe,%r11,%r14
  mov    %r8,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rdx,%rdi
  lea    (%rcx,%r13,1),%rcx
  mov    %r8,%r13
  rorx   $0x1c,%r8,%r15
  add    %rcx,%r10
  and    %r9,%rdi
  xor    %r15,%r12
  lea    (%rcx,%rdi,1),%rcx
  lea    (%rcx,%r12,1),%rcx
  and    %rdx,%r13
  lea    (%rcx,%r13,1),%rcx
  mov    %r10,%rdi
  add    0x30(%rsp),%rbx
  and    %r11,%rdi
  rorx   $0x29,%r10,%r13
  rorx   $0x12,%r10,%r14
  lea    (%rbx,%rdi,1),%rbx
  andn   %rax,%r10,%rdi
  rorx   $0x22,%rcx,%r12
  xor    %r14,%r13
  lea    (%rbx,%rdi,1),%rbx
  rorx   $0x27,%rcx,%r15
  rorx   $0xe,%r10,%r14
  mov    %rcx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r8,%rdi
  lea    (%rbx,%r13,1),%rbx
  mov    %rcx,%r13
  rorx   $0x1c,%rcx,%r15
  add    %rbx,%r9
  and    %rdx,%rdi
  xor    %r15,%r12
  lea    (%rbx,%rdi,1),%rbx
  lea    (%rbx,%r12,1),%rbx
  and    %r8,%r13
  lea    (%rbx,%r13,1),%rbx
  mov    %r9,%rdi
  add    0x38(%rsp),%rax
  and    %r10,%rdi
  rorx   $0x29,%r9,%r13
  rorx   $0x12,%r9,%r14
  lea    (%rax,%rdi,1),%rax
  andn   %r11,%r9,%rdi
  rorx   $0x22,%rbx,%r12
  xor    %r14,%r13
  lea    (%rax,%rdi,1),%rax
  rorx   $0x27,%rbx,%r15
  rorx   $0xe,%r9,%r14
  mov    %rbx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rcx,%rdi
  lea    (%rax,%r13,1),%rax
  mov    %rbx,%r13
  rorx   $0x1c,%rbx,%r15
  add    %rax,%rdx
  and    %r8,%rdi
  xor    %r15,%r12
  lea    (%rax,%rdi,1),%rax
  lea    (%rax,%r12,1),%rax
  and    %rcx,%r13
  lea    (%rax,%r13,1),%rax
  vmovdqa %ymm0,0x20(%rsp)
  mov    %rdx,%rdi
  add    0x40(%rsp),%r11
  and    %r9,%rdi
  rorx   $0x29,%rdx,%r13
  rorx   $0x12,%rdx,%r14
  lea    (%r11,%rdi,1),%r11
  andn   %r10,%rdx,%rdi
  rorx   $0x22,%rax,%r12
  xor    %r14,%r13
  lea    (%r11,%rdi,1),%r11
  rorx   $0x27,%rax,%r15
  rorx   $0xe,%rdx,%r14
  mov    %rax,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rbx,%rdi
  lea    (%r11,%r13,1),%r11
  mov    %rax,%r13
  rorx   $0x1c,%rax,%r15
  add    %r11,%r8
  and    %rcx,%rdi
  xor    %r15,%r12
  lea    (%r11,%rdi,1),%r11
  lea    (%r11,%r12,1),%r11
  and    %rbx,%r13
  lea    (%r11,%r13,1),%r11
  mov    %r8,%rdi
  add    0x48(%rsp),%r10
  and    %rdx,%rdi
  rorx   $0x29,%r8,%r13
  rorx   $0x12,%r8,%r14
  lea    (%r10,%rdi,1),%r10
  andn   %r9,%r8,%rdi
  rorx   $0x22,%r11,%r12
  xor    %r14,%r13
  lea    (%r10,%rdi,1),%r10
  rorx   $0x27,%r11,%r15
  rorx   $0xe,%r8,%r14
  mov    %r11,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rax,%rdi
  lea    (%r10,%r13,1),%r10
  mov    %r11,%r13
  rorx   $0x1c,%r11,%r15
  add    %r10,%rcx
  and    %rbx,%rdi
  xor    %r15,%r12
  lea    (%r10,%rdi,1),%r10
  lea    (%r10,%r12,1),%r10
  and    %rax,%r13
  lea    (%r10,%r13,1),%r10
  mov    %rcx,%rdi
  add    0x50(%rsp),%r9
  and    %r8,%rdi
  rorx   $0x29,%rcx,%r13
  rorx   $0x12,%rcx,%r14
  lea    (%r9,%rdi,1),%r9
  andn   %rdx,%rcx,%rdi
  rorx   $0x22,%r10,%r12
  xor    %r14,%r13
  lea    (%r9,%rdi,1),%r9
  rorx   $0x27,%r10,%r15
  rorx   $0xe,%rcx,%r14
  mov    %r10,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r11,%rdi
  lea    (%r9,%r13,1),%r9
  mov    %r10,%r13
  rorx   $0x1c,%r10,%r15
  add    %r9,%rbx
  and    %rax,%rdi
  xor    %r15,%r12
  lea    (%r9,%rdi,1),%r9
  lea    (%r9,%r12,1),%r9
  and    %r11,%r13
  lea    (%r9,%r13,1),%r9
  mov    %rbx,%rdi
  add    0x58(%rsp),%rdx
  and    %rcx,%rdi
  rorx   $0x29,%rbx,%r13
  rorx   $0x12,%rbx,%r14
  lea    (%rdx,%rdi,1),%rdx
  andn   %r8,%rbx,%rdi
  rorx   $0x22,%r9,%r12
  xor    %r14,%r13
  lea    (%rdx,%rdi,1),%rdx
  rorx   $0x27,%r9,%r15
  rorx   $0xe,%rbx,%r14
  mov    %r9,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r10,%rdi
  lea    (%rdx,%r13,1),%rdx
  mov    %r9,%r13
  rorx   $0x1c,%r9,%r15
  add    %rdx,%rax
  and    %r11,%rdi
  xor    %r15,%r12
  lea    (%rdx,%rdi,1),%rdx
  lea    (%rdx,%r12,1),%rdx
  and    %r10,%r13
  lea    (%rdx,%r13,1),%rdx
  vmovdqa %ymm0,0x40(%rsp)
  mov    %rax,%rdi
  add    0x60(%rsp),%r8
  and    %rbx,%rdi
  rorx   $0x29,%rax,%r13
  rorx   $0x12,%rax,%r14
  lea    (%r8,%rdi,1),%r8
  andn   %rcx,%rax,%rdi
  rorx   $0x22,%rdx,%r12
  xor    %r14,%r13
  lea    (%r8,%rdi,1),%r8
  rorx   $0x27,%rdx,%r15
  rorx   $0xe,%rax,%r14
  mov    %rdx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r9,%rdi
  lea    (%r8,%r13,1),%r8
  mov    %rdx,%r13
  rorx   $0x1c,%rdx,%r15
  add    %r8,%r11
  and    %r10,%rdi
  xor    %r15,%r12
  lea    (%r8,%rdi,1),%r8
  lea    (%r8,%r12,1),%r8
  and    %r9,%r13
  lea    (%r8,%r13,1),%r8
  mov    %r11,%rdi
  add    0x68(%rsp),%rcx
  and    %rax,%rdi
  rorx   $0x29,%r11,%r13
  rorx   $0x12,%r11,%r14
  lea    (%rcx,%rdi,1),%rcx
  andn   %rbx,%r11,%rdi
  rorx   $0x22,%r8,%r12
  xor    %r14,%r13
  lea    (%rcx,%rdi,1),%rcx
  rorx   $0x27,%r8,%r15
  rorx   $0xe,%r11,%r14
  mov    %r8,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rdx,%rdi
  lea    (%rcx,%r13,1),%rcx
  mov    %r8,%r13
  rorx   $0x1c,%r8,%r15
  add    %rcx,%r10
  and    %r9,%rdi
  xor    %r15,%r12
  lea    (%rcx,%rdi,1),%rcx
  lea    (%rcx,%r12,1),%rcx
  and    %rdx,%r13
  lea    (%rcx,%r13,1),%rcx
  mov    %r10,%rdi
  add    0x70(%rsp),%rbx
  and    %r11,%rdi
  rorx   $0x29,%r10,%r13
  rorx   $0x12,%r10,%r14
  lea    (%rbx,%rdi,1),%rbx
  andn   %rax,%r10,%rdi
  rorx   $0x22,%rcx,%r12
  xor    %r14,%r13
  lea    (%rbx,%rdi,1),%rbx
  rorx   $0x27,%rcx,%r15
  rorx   $0xe,%r10,%r14
  mov    %rcx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %r8,%rdi
  lea    (%rbx,%r13,1),%rbx
  mov    %rcx,%r13
  rorx   $0x1c,%rcx,%r15
  add    %rbx,%r9
  and    %rdx,%rdi
  xor    %r15,%r12
  lea    (%rbx,%rdi,1),%rbx
  lea    (%rbx,%r12,1),%rbx
  and    %r8,%r13
  lea    (%rbx,%r13,1),%rbx
  mov    %r9,%rdi
  add    0x78(%rsp),%rax
  and    %r10,%rdi
  rorx   $0x29,%r9,%r13
  rorx   $0x12,%r9,%r14
  lea    (%rax,%rdi,1),%rax
  andn   %r11,%r9,%rdi
  rorx   $0x22,%rbx,%r12
  xor    %r14,%r13
  lea    (%rax,%rdi,1),%rax
  rorx   $0x27,%rbx,%r15
  rorx   $0xe,%r9,%r14
  mov    %rbx,%rdi
  xor    %r15,%r12
  xor    %r14,%r13
  xor    %rcx,%rdi
  lea    (%rax,%r13,1),%rax
  mov    %rbx,%r13
  rorx   $0x1c,%rbx,%r15
  add    %rax,%rdx
  and    %r8,%rdi
  xor    %r15,%r12
  lea    (%rax,%rdi,1),%rax
  lea    (%rax,%r12,1),%rax
  and    %rcx,%r13
  lea    (%rax,%r13,1),%rax
  vmovdqa %ymm0,0x60(%rsp)
  add    (%rsi),%rax
  mov    %rax,(%rsi)
  xor    %eax,%eax
  add    0x8(%rsi),%rbx
  mov    %rbx,0x8(%rsi)
  add    0x10(%rsi),%rcx
  mov    %rcx,0x10(%rsi)
  add    0x18(%rsi),%r8
  mov    %r8,0x18(%rsi)
  add    0x20(%rsi),%rdx
  mov    %rdx,0x20(%rsi)
  add    0x28(%rsi),%r9
  mov    %r9,0x28(%rsi)
  add    0x30(%rsi),%r10
  mov    %r10,0x30(%rsi)
  add    0x38(%rsi),%r11
  mov    %r11,0x38(%rsi)
  mov    0xa0(%rsp),%rbp
  mov    0xa8(%rsp),%rbx
  mov    0xb0(%rsp),%r12
  mov    0xb8(%rsp),%r13
  mov    0xc0(%rsp),%r14
  mov    0xc8(%rsp),%r15
  mov    0x98(%rsp),%rsp

.Lnowork:
{$IF DEFINED(WIN64)}
  movdqa (%rsp),%xmm6
  movdqa 0x10(%rsp),%xmm7
  movdqa 0x20(%rsp),%xmm8
  movdqa 0x30(%rsp),%xmm9
  movdqa 0x40(%rsp),%xmm10
  addq   $88, %rsp
  movq   16(%rsp), %rsi
  movq   24(%rsp), %rdi
{$ENDIF}
  ret

.balign 64

.LK512:
  .quad  0x428a2f98d728ae22,0x7137449123ef65cd
  .quad  0xb5c0fbcfec4d3b2f,0xe9b5dba58189dbbc
  .quad  0x3956c25bf348b538,0x59f111f1b605d019
  .quad  0x923f82a4af194f9b,0xab1c5ed5da6d8118
  .quad  0xd807aa98a3030242,0x12835b0145706fbe
  .quad  0x243185be4ee4b28c,0x550c7dc3d5ffb4e2
  .quad  0x72be5d74f27b896f,0x80deb1fe3b1696b1
  .quad  0x9bdc06a725c71235,0xc19bf174cf692694
  .quad  0xe49b69c19ef14ad2,0xefbe4786384f25e3
  .quad  0x0fc19dc68b8cd5b5,0x240ca1cc77ac9c65
  .quad  0x2de92c6f592b0275,0x4a7484aa6ea6e483
  .quad  0x5cb0a9dcbd41fbd4,0x76f988da831153b5
  .quad  0x983e5152ee66dfab,0xa831c66d2db43210
  .quad  0xb00327c898fb213f,0xbf597fc7beef0ee4
  .quad  0xc6e00bf33da88fc2,0xd5a79147930aa725
  .quad  0x06ca6351e003826f,0x142929670a0e6e70
  .quad  0x27b70a8546d22ffc,0x2e1b21385c26c926
  .quad  0x4d2c6dfc5ac42aed,0x53380d139d95b3df
  .quad  0x650a73548baf63de,0x766a0abb3c77b2a8
  .quad  0x81c2c92e47edaee6,0x92722c851482353b
  .quad  0xa2bfe8a14cf10364,0xa81a664bbc423001
  .quad  0xc24b8b70d0f89791,0xc76c51a30654be30
  .quad  0xd192e819d6ef5218,0xd69906245565a910
  .quad  0xf40e35855771202a,0x106aa07032bbd1b8
  .quad  0x19a4c116b8d2d0c8,0x1e376c085141ab53
  .quad  0x2748774cdf8eeb99,0x34b0bcb5e19b48a8
  .quad  0x391c0cb3c5c95a63,0x4ed8aa4ae3418acb
  .quad  0x5b9cca4f7763e373,0x682e6ff3d6b2b8a3
  .quad  0x748f82ee5defb2fc,0x78a5636f43172f60
  .quad  0x84c87814a1f0ab72,0x8cc702081a6439ec
  .quad  0x90befffa23631e28,0xa4506cebde82bde9
  .quad  0xbef9a3f7b2c67915,0xc67178f2e372532b
  .quad  0xca273eceea26619c,0xd186b8c721c0c207
  .quad  0xeada7dd6cde0eb1e,0xf57d4f7fee6ed178
  .quad  0x06f067aa72176fba,0x0a637dc5a2c898a6
  .quad  0x113f9804bef90dae,0x1b710b35131c471b
  .quad  0x28db77f523047d84,0x32caab7b40c72493
  .quad  0x3c9ebe0a15c9bebc,0x431d67c49c100d4c
  .quad  0x4cc5d4becb3e42b6,0x597f299cfc657e2a
  .quad  0x5fcb6fab3ad6faec,0x6c44198c4a475817
end;

