// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl $0x42004001, %esi       # imm = 0x42004001
callq 0x60b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1349e
movq -0x10(%rbp), %rdi
leaq 0x11b2d(%rip), %rsi     # 0x24fb6
movl $0x1cc3, %edx           # imm = 0x1CC3
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x136fa
jmp 0x134a0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rax
addq $0x4, %rax
movq %rax, 0x8(%rcx)
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %edx
movl $0x420042, %esi         # imm = 0x420042
callq 0x6770
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x134fd
movq -0x10(%rbp), %rdi
leaq 0x11ace(%rip), %rsi     # 0x24fb6
movl $0x1cc9, %edx           # imm = 0x1CC9
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x136fa
jmp 0x134ff
movq -0x18(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x1354b
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x4(%rax), %edx
movl $0x420041, %esi         # imm = 0x420041
callq 0x6770
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13547
movq -0x10(%rbp), %rdi
leaq 0x11a84(%rip), %rsi     # 0x24fb6
movl $0x1cce, %edx           # imm = 0x1CCE
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x136fa
jmp 0x13549
jmp 0x1354b
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x13571
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x420045, %esi         # imm = 0x420045
callq 0x6d40
movl %eax, -0x1c(%rbp)
jmp 0x1358b
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x6d20
movl %eax, -0x1c(%rbp)
jmp 0x1358d
cmpl $0x0, -0x1c(%rbp)
je 0x135b3
movq -0x10(%rbp), %rdi
leaq 0x11a18(%rip), %rsi     # 0x24fb6
movl $0x1cd9, %edx           # imm = 0x1CD9
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x136fa
jmp 0x135b5
movq -0x18(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x13601
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x14(%rax), %edx
movl $0x420028, %esi         # imm = 0x420028
callq 0x6770
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x135fd
movq -0x10(%rbp), %rdi
leaq 0x119ce(%rip), %rsi     # 0x24fb6
movl $0x1cde, %edx           # imm = 0x1CDE
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x136fa
jmp 0x135ff
jmp 0x13601
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x18(%rax)
je 0x1364d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x18(%rax), %edx
movl $0x42002a, %esi         # imm = 0x42002A
callq 0x6420
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13649
movq -0x10(%rbp), %rdi
leaq 0x11982(%rip), %rsi     # 0x24fb6
movl $0x1ce4, %edx           # imm = 0x1CE4
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x136fa
jmp 0x1364b
jmp 0x1364d
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x13693
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x6480
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1368f
movq -0x10(%rbp), %rdi
leaq 0x11939(%rip), %rsi     # 0x24fb6
movl $0x1cea, %edx           # imm = 0x1CEA
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x136fa
jmp 0x13691
jmp 0x13693
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rax
subq %rax, %rsi
callq 0x6ba0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x136e5
movq -0x10(%rbp), %rdi
leaq 0x118e3(%rip), %rsi     # 0x24fb6
movl $0x1cf1, %edx           # imm = 0x1CF1
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x136fa
jmp 0x136e7
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)