// File: /workspace/github_c_makefile_star2_O1/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 0xe0d0
movl %eax, %ebp
leaq 0x131ba(%rip), %rsi     # 0x21280
movq %rbx, %rdi
movl $0x1cc3, %edx           # imm = 0x1CC3
jmp 0xe102
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 0xe112
movl %eax, %ebp
leaq 0x13186(%rip), %rsi     # 0x21280
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 0xe13e
movq %rbx, %rdi
movl $0x420041, %esi         # imm = 0x420041
callq 0x66d0
testl %eax, %eax
je 0xe13e
movl %eax, %ebp
leaq 0x1314c(%rip), %rsi     # 0x21280
movq %rbx, %rdi
movl $0x1cce, %edx           # imm = 0x1CCE
jmp 0xe102
cmpq $0x0, 0x20(%r14)
je 0xe158
movq 0x8(%r14), %rdx
movq %rbx, %rdi
movl $0x420045, %esi         # imm = 0x420045
callq 0x6c10
jmp 0xe167
movl (%r14), %esi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x6bf0
movl %eax, %ebp
testl %eax, %eax
je 0xe17e
leaq 0x1310c(%rip), %rsi     # 0x21280
movq %rbx, %rdi
movl $0x1cd9, %edx           # imm = 0x1CD9
jmp 0xe102
movl 0x14(%r14), %edx
testl %edx, %edx
je 0xe1ad
movq %rbx, %rdi
movl $0x420028, %esi         # imm = 0x420028
callq 0x66d0
testl %eax, %eax
je 0xe1ad
movl %eax, %ebp
leaq 0x130e0(%rip), %rsi     # 0x21280
movq %rbx, %rdi
movl $0x1cde, %edx           # imm = 0x1CDE
jmp 0xe102
movl 0x18(%r14), %edx
cmpl $-0x1, %edx
je 0xe1dd
movq %rbx, %rdi
movl $0x42002a, %esi         # imm = 0x42002A
callq 0x63d0
testl %eax, %eax
je 0xe1dd
movl %eax, %ebp
leaq 0x130b0(%rip), %rsi     # 0x21280
movq %rbx, %rdi
movl $0x1ce4, %edx           # imm = 0x1CE4
jmp 0xe102
movq 0x20(%r14), %rsi
testq %rsi, %rsi
je 0xe208
movq %rbx, %rdi
callq 0x6430
testl %eax, %eax
je 0xe208
movl %eax, %ebp
leaq 0x13085(%rip), %rsi     # 0x21280
movq %rbx, %rdi
movl $0x1cea, %edx           # imm = 0x1CEA
jmp 0xe102
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6a80
testl %eax, %eax
je 0xe238
movl %eax, %ebp
leaq 0x13055(%rip), %rsi     # 0x21280
movq %rbx, %rdi
movl $0x1cf1, %edx           # imm = 0x1CF1
jmp 0xe102
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xe107