// File: /workspace/github_c_makefile_star2_O0/MartinDrab[P]netpipe/sha2.c
// Function: sha256_final
void sha256_final(sha256_ctx *ctx, unsigned char *digest)
{
    unsigned int block_nb;
    unsigned int pm_len;
    unsigned int len_b;

#ifndef UNROLL_LOOPS
    int i;
#endif

    block_nb = (1 + ((SHA256_BLOCK_SIZE - 9)
                     < (ctx->len % SHA256_BLOCK_SIZE)));

    len_b = (ctx->tot_len + ctx->len) << 3;
    pm_len = block_nb << 6;

    memset(ctx->block + ctx->len, 0, pm_len - ctx->len);
    ctx->block[ctx->len] = 0x80;
    UNPACK32(len_b, ctx->block + pm_len - 4);

    sha256_transf(ctx, ctx->block, block_nb);

#ifndef UNROLL_LOOPS
    for (i = 0 ; i < 8; i++) {
        UNPACK32(ctx->h[i], &digest[i << 2]);
    }
#else
   UNPACK32(ctx->h[0], &digest[ 0]);
   UNPACK32(ctx->h[1], &digest[ 4]);
   UNPACK32(ctx->h[2], &digest[ 8]);
   UNPACK32(ctx->h[3], &digest[12]);
   UNPACK32(ctx->h[4], &digest[16]);
   UNPACK32(ctx->h[5], &digest[20]);
   UNPACK32(ctx->h[6], &digest[24]);
   UNPACK32(ctx->h[7], &digest[28]);
#endif /* !UNROLL_LOOPS */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0x3f, %ecx
movl $0x37, %eax
cmpl %ecx, %eax
setb %al
andb $0x1, %al
movzbl %al, %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movq -0x8(%rbp), %rcx
addl 0x4(%rcx), %eax
shll $0x3, %eax
movl %eax, -0x1c(%rbp)
movl -0x14(%rbp), %eax
shll $0x6, %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
addq %rax, %rdi
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
movl %eax, %edx
xorl %esi, %esi
callq 0x2100
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x4(%rcx), %ecx
movb $-0x80, 0x8(%rax,%rcx)
movl -0x1c(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
movb %dl, 0x7(%rax,%rcx)
movl -0x1c(%rbp), %eax
shrl $0x8, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
movb %dl, 0x6(%rax,%rcx)
movl -0x1c(%rbp), %eax
shrl $0x10, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
movb %dl, 0x5(%rax,%rcx)
movl -0x1c(%rbp), %eax
shrl $0x18, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
movb %dl, 0x4(%rax,%rcx)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x8, %rsi
movl -0x14(%rbp), %edx
callq 0x90d0
movl $0x0, -0x20(%rbp)
cmpl $0x8, -0x20(%rbp)
jge 0x989e
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl 0x88(%rax,%rcx,4), %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
movb %dl, 0x3(%rax,%rcx)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl 0x88(%rax,%rcx,4), %eax
shrl $0x8, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
movb %dl, 0x2(%rax,%rcx)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl 0x88(%rax,%rcx,4), %eax
shrl $0x10, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
movb %dl, 0x1(%rax,%rcx)
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl 0x88(%rax,%rcx,4), %eax
shrl $0x18, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x97f6
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)