// File: /workspace/github_cpp_makefile_star2_O2/Computer-Kids-Club[P]screenshare-pro-backend/sha1.c
// Function: SHA1ProcessMessageBlock(SHA1Context*)
void SHA1ProcessMessageBlock(SHA1Context *context)
{
    const unsigned K[] =            /* Constants defined in SHA-1   */      
    {
        0x5A827999,
        0x6ED9EBA1,
        0x8F1BBCDC,
        0xCA62C1D6
    };
    int         t;                  /* Loop counter                 */
    unsigned    temp;               /* Temporary word value         */
    unsigned    W[80];              /* Word sequence                */
    unsigned    A, B, C, D, E;      /* Word buffers                 */

    /*
     *  Initialize the first 16 words in the array W
     */
    for(t = 0; t < 16; t++)
    {
        W[t] = ((unsigned) context->Message_Block[t * 4]) << 24;
        W[t] |= ((unsigned) context->Message_Block[t * 4 + 1]) << 16;
        W[t] |= ((unsigned) context->Message_Block[t * 4 + 2]) << 8;
        W[t] |= ((unsigned) context->Message_Block[t * 4 + 3]);
    }

    for(t = 16; t < 80; t++)
    {
       W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]);
    }

    A = context->Message_Digest[0];
    B = context->Message_Digest[1];
    C = context->Message_Digest[2];
    D = context->Message_Digest[3];
    E = context->Message_Digest[4];

    for(t = 0; t < 20; t++)
    {
        temp =  SHA1CircularShift(5,A) +
                ((B & C) | ((~B) & D)) + E + W[t] + K[0];
        temp &= 0xFFFFFFFF;
        E = D;
        D = C;
        C = SHA1CircularShift(30,B);
        B = A;
        A = temp;
    }

    for(t = 20; t < 40; t++)
    {
        temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1];
        temp &= 0xFFFFFFFF;
        E = D;
        D = C;
        C = SHA1CircularShift(30,B);
        B = A;
        A = temp;
    }

    for(t = 40; t < 60; t++)
    {
        temp = SHA1CircularShift(5,A) +
               ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2];
        temp &= 0xFFFFFFFF;
        E = D;
        D = C;
        C = SHA1CircularShift(30,B);
        B = A;
        A = temp;
    }

    for(t = 60; t < 80; t++)
    {
        temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3];
        temp &= 0xFFFFFFFF;
        E = D;
        D = C;
        C = SHA1CircularShift(30,B);
        B = A;
        A = temp;
    }

    context->Message_Digest[0] =
                        (context->Message_Digest[0] + A) & 0xFFFFFFFF;
    context->Message_Digest[1] =
                        (context->Message_Digest[1] + B) & 0xFFFFFFFF;
    context->Message_Digest[2] =
                        (context->Message_Digest[2] + C) & 0xFFFFFFFF;
    context->Message_Digest[3] =
                        (context->Message_Digest[3] + D) & 0xFFFFFFFF;
    context->Message_Digest[4] =
                        (context->Message_Digest[4] + E) & 0xFFFFFFFF;

    context->Message_Block_Index = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movabsq $0x7, %rax
cmpq $0x17, %rax
je 0x5e84
movl (%rdi,%rax,4), %ecx
bswapl %ecx
movl %ecx, -0x18c(%rbp,%rax,4)
incq %rax
jmp 0x5e6d
movabsq $0x10, %rax
cmpq $0x50, %rax
je 0x5ebe
movl -0x190(%rbp,%rax,4), %ecx
xorl -0x17c(%rbp,%rax,4), %ecx
xorl -0x1a8(%rbp,%rax,4), %ecx
xorl -0x1b0(%rbp,%rax,4), %ecx
roll %ecx
movl %ecx, -0x170(%rbp,%rax,4)
incq %rax
jmp 0x5e8e
movl (%rdi), %r8d
movl 0x4(%rdi), %esi
movl 0x8(%rdi), %edx
movl 0xc(%rdi), %r14d
movl 0x10(%rdi), %r10d
xorl %r11d, %r11d
movl %r8d, %r12d
movl %esi, %r9d
movl %edx, %r13d
movl %r14d, -0x2c(%rbp)
movl %r10d, -0x30(%rbp)
movl %r14d, %ebx
movl %r13d, %r14d
movl %r12d, %r15d
cmpq $0x14, %r11
je 0x5f2f
movl %r15d, %r12d
roll $0x5, %r12d
movl %r14d, %r13d
xorl %ebx, %r13d
andl %r9d, %r13d
xorl %ebx, %r13d
movl -0x170(%rbp,%r11,4), %eax
addl %r10d, %r12d
addl %r13d, %r12d
movl %r9d, %r13d
roll $0x1e, %r13d
addl %eax, %r12d
addl $0x5a827999, %r12d      # imm = 0x5A827999
incq %r11
movl %r15d, %r9d
movl %ebx, %r10d
jmp 0x5ee3
movabsq $0x14, %r13
movl %ebx, %r11d
movl %r14d, %ebx
movl %r15d, %r12d
cmpq $0x28, %r13
je 0x5f81
movl %r12d, %eax
roll $0x5, %eax
movl %ebx, %r15d
xorl %r9d, %r15d
xorl %r11d, %r15d
addl %eax, %r15d
movl -0x170(%rbp,%r13,4), %eax
addl %r10d, %r15d
movl %r9d, %r14d
roll $0x1e, %r14d
addl %eax, %r15d
addl $0x6ed9eba1, %r15d      # imm = 0x6ED9EBA1
incq %r13
movl %r12d, %r9d
movl %r11d, %r10d
jmp 0x5f39
movabsq $0x28, %r13
movl %r11d, %r14d
movl %ebx, %r11d
movl %r12d, %r15d
cmpq $0x3c, %r13
je 0x5fdc
movl %r15d, %eax
roll $0x5, %eax
movl %r14d, %ebx
orl %r11d, %ebx
andl %r9d, %ebx
movl %r14d, %r12d
andl %r11d, %r12d
orl %ebx, %r12d
movl -0x170(%rbp,%r13,4), %ecx
addl %r10d, %eax
addl %r12d, %eax
movl %r9d, %ebx
roll $0x1e, %ebx
leal (%rcx,%rax), %r12d
addl $0x8f1bbcdc, %r12d      # imm = 0x8F1BBCDC
incq %r13
movl %r15d, %r9d
movl %r14d, %r10d
jmp 0x5f8b
movabsq $0x3c, %r12
movl %r14d, %ebx
movl %r11d, %r14d
movl %r15d, %r13d
cmpq $0x50, %r12
je 0x602d
movl %r13d, %eax
roll $0x5, %eax
movl %r14d, %ecx
xorl %r9d, %ecx
xorl %ebx, %ecx
addl %eax, %ecx
movl -0x170(%rbp,%r12,4), %eax
addl %r10d, %ecx
movl %r9d, %r11d
roll $0x1e, %r11d
leal (%rax,%rcx), %r15d
addl $0xca62c1d6, %r15d      # imm = 0xCA62C1D6
incq %r12
movl %r13d, %r9d
movl %ebx, %r10d
jmp 0x5fe6
addl %r8d, %r13d
movl %r13d, (%rdi)
addl %esi, %r9d
movl %r9d, 0x4(%rdi)
addl %edx, %r14d
movl %r14d, 0x8(%rdi)
addl -0x2c(%rbp), %ebx
movl %ebx, 0xc(%rdi)
addl -0x30(%rbp), %r10d
movl %r10d, 0x10(%rdi)
andl $0x0, 0x5c(%rdi)
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)