// File: /workspace/github_c_makefile_star2_O3/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_encode_key_block
int
kmip_encode_key_block(KMIP *ctx, const KeyBlock *value)
{
    int result = 0;
    result = kmip_encode_int32_be(ctx, TAG_TYPE(KMIP_TAG_KEY_BLOCK, KMIP_TYPE_STRUCTURE));
    CHECK_RESULT(ctx, result);
    
    uint8 *length_index = ctx->index;
    uint8 *value_index = ctx->index += 4;
    
    result = kmip_encode_enum(ctx, KMIP_TAG_KEY_FORMAT_TYPE, value->key_format_type);
    CHECK_RESULT(ctx, result);
    
    if(value->key_compression_type != 0)
    {
        result = kmip_encode_enum(ctx, KMIP_TAG_KEY_COMPRESSION_TYPE, value->key_compression_type);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->key_wrapping_data != NULL)
    {
        result = kmip_encode_byte_string(ctx, KMIP_TAG_KEY_VALUE, (ByteString*)value->key_value);
    }
    else
    {
        result = kmip_encode_key_value(ctx, value->key_format_type, (KeyValue*)value->key_value);
    }
    CHECK_RESULT(ctx, result);
    
    if(value->cryptographic_algorithm != 0)
    {
        result = kmip_encode_enum(ctx, KMIP_TAG_CRYPTOGRAPHIC_ALGORITHM, value->cryptographic_algorithm);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->cryptographic_length != KMIP_UNSET)
    {
        result = kmip_encode_integer(ctx, KMIP_TAG_CRYPTOGRAPHIC_LENGTH, value->cryptographic_length);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->key_wrapping_data != NULL)
    {
        result = kmip_encode_key_wrapping_data(ctx, value->key_wrapping_data);
        CHECK_RESULT(ctx, result);
    }
    
    uint8 *curr_index = ctx->index;
    ctx->index = length_index;
    
    result = kmip_encode_length(ctx, curr_index - value_index);
    CHECK_RESULT(ctx, result);

    ctx->index = curr_index;
    
    return(KMIP_OK);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl $0x42004001, %esi       # imm = 0x42004001
callq 0x60a0
testl %eax, %eax
je 0xddaa
movl %eax, %ebp
leaq 0x12550(%rip), %rsi     # 0x202f0
movq %rbx, %rdi
movl $0x1cc3, %edx           # imm = 0x1CC3
jmp 0xdddc
movq 0x8(%rbx), %r12
leaq 0x4(%r12), %r15
movq %r15, 0x8(%rbx)
movl (%r14), %edx
movq %rbx, %rdi
movl $0x420042, %esi         # imm = 0x420042
callq 0x66d0
testl %eax, %eax
je 0xddec
movl %eax, %ebp
leaq 0x1251c(%rip), %rsi     # 0x202f0
movq %rbx, %rdi
movl $0x1cc9, %edx           # imm = 0x1CC9
callq 0x6de0
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl 0x4(%r14), %edx
testl %edx, %edx
je 0xde18
movq %rbx, %rdi
movl $0x420041, %esi         # imm = 0x420041
callq 0x66d0
testl %eax, %eax
je 0xde18
movl %eax, %ebp
leaq 0x124e2(%rip), %rsi     # 0x202f0
movq %rbx, %rdi
movl $0x1cce, %edx           # imm = 0x1CCE
jmp 0xdddc
cmpq $0x0, 0x20(%r14)
je 0xde32
movq 0x8(%r14), %rdx
movq %rbx, %rdi
movl $0x420045, %esi         # imm = 0x420045
callq 0x6c10
jmp 0xde41
movl (%r14), %esi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x6bf0
movl %eax, %ebp
testl %eax, %eax
je 0xde58
leaq 0x124a2(%rip), %rsi     # 0x202f0
movq %rbx, %rdi
movl $0x1cd9, %edx           # imm = 0x1CD9
jmp 0xdddc
movl 0x14(%r14), %edx
testl %edx, %edx
je 0xde87
movq %rbx, %rdi
movl $0x420028, %esi         # imm = 0x420028
callq 0x66d0
testl %eax, %eax
je 0xde87
movl %eax, %ebp
leaq 0x12476(%rip), %rsi     # 0x202f0
movq %rbx, %rdi
movl $0x1cde, %edx           # imm = 0x1CDE
jmp 0xdddc
movl 0x18(%r14), %edx
cmpl $-0x1, %edx
je 0xdeb7
movq %rbx, %rdi
movl $0x42002a, %esi         # imm = 0x42002A
callq 0x63d0
testl %eax, %eax
je 0xdeb7
movl %eax, %ebp
leaq 0x12446(%rip), %rsi     # 0x202f0
movq %rbx, %rdi
movl $0x1ce4, %edx           # imm = 0x1CE4
jmp 0xdddc
movq 0x20(%r14), %rsi
testq %rsi, %rsi
je 0xdee2
movq %rbx, %rdi
callq 0x6430
testl %eax, %eax
je 0xdee2
movl %eax, %ebp
leaq 0x1241b(%rip), %rsi     # 0x202f0
movq %rbx, %rdi
movl $0x1cea, %edx           # imm = 0x1CEA
jmp 0xdddc
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6a80
testl %eax, %eax
je 0xdf12
movl %eax, %ebp
leaq 0x123eb(%rip), %rsi     # 0x202f0
movq %rbx, %rdi
movl $0x1cf1, %edx           # imm = 0x1CF1
jmp 0xdddc
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xdde1