// File: /workspace/github_c_makefile_star2_O0/blasphemy[P]mmc-utils/3rdparty/hmac_sha/hmac_sha2.c
// Function: hmac_sha384_init
void hmac_sha384_init(hmac_sha384_ctx *ctx, const unsigned char *key,
                      unsigned int key_size)
{
    unsigned int fill;
    unsigned int num;

    const unsigned char *key_used;
    unsigned char key_temp[SHA384_DIGEST_SIZE];
    int i;

    if (key_size == SHA384_BLOCK_SIZE) {
        key_used = key;
        num = SHA384_BLOCK_SIZE;
    } else {
        if (key_size > SHA384_BLOCK_SIZE){
            num = SHA384_DIGEST_SIZE;
            sha384(key, key_size, key_temp);
            key_used = key_temp;
        } else { /* key_size > SHA384_BLOCK_SIZE */
            key_used = key;
            num = key_size;
        }
        fill = SHA384_BLOCK_SIZE - num;

        memset(ctx->block_ipad + num, 0x36, fill);
        memset(ctx->block_opad + num, 0x5c, fill);
    }

    for (i = 0; i < (int) num; i++) {
        ctx->block_ipad[i] = key_used[i] ^ 0x36;
        ctx->block_opad[i] = key_used[i] ^ 0x5c;
    }

    sha384_init(&ctx->ctx_inside);
    sha384_update(&ctx->ctx_inside, ctx->block_ipad, SHA384_BLOCK_SIZE);

    sha384_init(&ctx->ctx_outside);
    sha384_update(&ctx->ctx_outside, ctx->block_opad,
                  SHA384_BLOCK_SIZE);

    /* for hmac_reinit */
    memcpy(&ctx->ctx_inside_reinit, &ctx->ctx_inside,
           sizeof(sha384_ctx));
    memcpy(&ctx->ctx_outside_reinit, &ctx->ctx_outside,
           sizeof(sha384_ctx));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
cmpl $0x80, -0x14(%rbp)
jne 0x100e0
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x80, -0x1c(%rbp)
jmp 0x10163
cmpl $0x80, -0x14(%rbp)
jbe 0x1010a
movl $0x30, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
leaq -0x60(%rbp), %rdx
callq 0x11830
leaq -0x60(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x10118
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl $0x80, %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
addq $0x520, %rdi            # imm = 0x520
movl -0x1c(%rbp), %eax
addq %rax, %rdi
movl -0x18(%rbp), %eax
movl %eax, %edx
movl $0x36, %esi
callq 0x30f0
movq -0x8(%rbp), %rdi
addq $0x5a0, %rdi            # imm = 0x5A0
movl -0x1c(%rbp), %eax
addq %rax, %rdi
movl -0x18(%rbp), %eax
movl %eax, %edx
movl $0x5c, %esi
callq 0x30f0
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x101bd
movq -0x28(%rbp), %rax
movslq -0x64(%rbp), %rcx
movzbl (%rax,%rcx), %eax
xorl $0x36, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x64(%rbp), %rcx
movb %dl, 0x520(%rax,%rcx)
movq -0x28(%rbp), %rax
movslq -0x64(%rbp), %rcx
movzbl (%rax,%rcx), %eax
xorl $0x5c, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x64(%rbp), %rcx
movb %dl, 0x5a0(%rax,%rcx)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x1016a
movq -0x8(%rbp), %rdi
callq 0x11880
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x520, %rsi            # imm = 0x520
movl $0x80, %edx
callq 0x118e0
movq -0x8(%rbp), %rdi
addq $0x148, %rdi            # imm = 0x148
callq 0x11880
movq -0x8(%rbp), %rdi
addq $0x148, %rdi            # imm = 0x148
movq -0x8(%rbp), %rsi
addq $0x5a0, %rsi            # imm = 0x5A0
movl $0x80, %edx
callq 0x118e0
movq -0x8(%rbp), %rdi
addq $0x290, %rdi            # imm = 0x290
movq -0x8(%rbp), %rsi
movl $0x148, %edx            # imm = 0x148
callq 0x31b0
movq -0x8(%rbp), %rdi
addq $0x3d8, %rdi            # imm = 0x3D8
movq -0x8(%rbp), %rsi
addq $0x148, %rsi            # imm = 0x148
movl $0x148, %edx            # imm = 0x148
callq 0x31b0
addq $0x70, %rsp
popq %rbp
retq
nop