// File: /workspace/github_c_makefile_star2_O0/blasphemy[P]mmc-utils/3rdparty/hmac_sha/hmac_sha2.c
// Function: hmac_sha256_init
void hmac_sha256_init(hmac_sha256_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[SHA256_DIGEST_SIZE];
    int i;

    if (key_size == SHA256_BLOCK_SIZE) {
        key_used = key;
        num = SHA256_BLOCK_SIZE;
    } else {
        if (key_size > SHA256_BLOCK_SIZE){
            num = SHA256_DIGEST_SIZE;
            sha256(key, key_size, key_temp);
            key_used = key_temp;
        } else { /* key_size > SHA256_BLOCK_SIZE */
            key_used = key;
            num = key_size;
        }
        fill = SHA256_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;
    }

    sha256_init(&ctx->ctx_inside);
    sha256_update(&ctx->ctx_inside, ctx->block_ipad, SHA256_BLOCK_SIZE);

    sha256_init(&ctx->ctx_outside);
    sha256_update(&ctx->ctx_outside, ctx->block_opad,
                  SHA256_BLOCK_SIZE);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
cmpl $0x40, -0x14(%rbp)
jne 0xfddd
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x40, -0x1c(%rbp)
jmp 0xfe5d
cmpl $0x40, -0x14(%rbp)
jbe 0xfe04
movl $0x20, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
leaq -0x50(%rbp), %rdx
callq 0x10b50
leaq -0x50(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xfe12
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl $0x40, %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
addq $0x2a0, %rdi            # imm = 0x2A0
movl -0x1c(%rbp), %eax
addq %rax, %rdi
movl -0x18(%rbp), %eax
movl %eax, %edx
movl $0x36, %esi
callq 0x30f0
movq -0x8(%rbp), %rdi
addq $0x2e0, %rdi            # imm = 0x2E0
movl -0x1c(%rbp), %eax
addq %rax, %rdi
movl -0x18(%rbp), %eax
movl %eax, %edx
movl $0x5c, %esi
callq 0x30f0
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xfeb7
movq -0x28(%rbp), %rax
movslq -0x54(%rbp), %rcx
movzbl (%rax,%rcx), %eax
xorl $0x36, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x54(%rbp), %rcx
movb %dl, 0x2a0(%rax,%rcx)
movq -0x28(%rbp), %rax
movslq -0x54(%rbp), %rcx
movzbl (%rax,%rcx), %eax
xorl $0x5c, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x54(%rbp), %rcx
movb %dl, 0x2e0(%rax,%rcx)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xfe64
movq -0x8(%rbp), %rdi
callq 0x10ba0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x2a0, %rsi            # imm = 0x2A0
movl $0x40, %edx
callq 0x10c00
movq -0x8(%rbp), %rdi
addq $0xa8, %rdi
callq 0x10ba0
movq -0x8(%rbp), %rdi
addq $0xa8, %rdi
movq -0x8(%rbp), %rsi
addq $0x2e0, %rsi            # imm = 0x2E0
movl $0x40, %edx
callq 0x10c00
movq -0x8(%rbp), %rdi
addq $0x150, %rdi            # imm = 0x150
movq -0x8(%rbp), %rsi
movl $0xa8, %edx
callq 0x31b0
movq -0x8(%rbp), %rdi
addq $0x1f8, %rdi            # imm = 0x1F8
movq -0x8(%rbp), %rsi
addq $0xa8, %rsi
movl $0xa8, %edx
callq 0x31b0
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)