// File: /workspace/github_c_makefile_star2_O2/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_encode_key_wrapping_data
int
kmip_encode_key_wrapping_data(KMIP *ctx, const KeyWrappingData *value)
{
    int result = 0;
    result = kmip_encode_int32_be(ctx, TAG_TYPE(KMIP_TAG_KEY_WRAPPING_DATA, 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_WRAPPING_METHOD, value->wrapping_method);
    CHECK_RESULT(ctx, result);
    
    if(value->encryption_key_info != NULL)
    {
        result = kmip_encode_encryption_key_information(ctx, value->encryption_key_info);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->mac_signature_key_info != NULL)
    {
        result = kmip_encode_mac_signature_key_information(ctx, value->mac_signature_key_info);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->mac_signature != NULL)
    {
        result = kmip_encode_byte_string(ctx, KMIP_TAG_MAC_SIGNATURE, value->mac_signature);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->iv_counter_nonce != NULL)
    {
        result = kmip_encode_byte_string(ctx, KMIP_TAG_IV_COUNTER_NONCE, value->iv_counter_nonce);
        CHECK_RESULT(ctx, result);
    }
    
    if(ctx->version >= KMIP_1_1)
    {
        result = kmip_encode_enum(ctx, KMIP_TAG_ENCODING_OPTION, value->encoding_option);
        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 $0x42004601, %esi       # imm = 0x42004601
callq 0x60a0
testl %eax, %eax
je 0xcabe
movl %eax, %ebp
leaq 0xaf2b(%rip), %rsi      # 0x179df
movq %rbx, %rdi
movl $0x1bf2, %edx           # imm = 0x1BF2
jmp 0xcaf0
movq 0x8(%rbx), %r12
leaq 0x4(%r12), %r15
movq %r15, 0x8(%rbx)
movl (%r14), %edx
movq %rbx, %rdi
movl $0x42009e, %esi         # imm = 0x42009E
callq 0x6700
testl %eax, %eax
je 0xcb00
movl %eax, %ebp
leaq 0xaef7(%rip), %rsi      # 0x179df
movq %rbx, %rdi
movl $0x1bf8, %edx           # imm = 0x1BF8
callq 0x6e80
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r14), %rsi
testq %rsi, %rsi
je 0xcb28
movq %rbx, %rdi
callq 0x63d0
testl %eax, %eax
je 0xcb28
movl %eax, %ebp
leaq 0xaec1(%rip), %rsi      # 0x179df
movq %rbx, %rdi
movl $0x1bfd, %edx           # imm = 0x1BFD
jmp 0xcaf0
movq 0x10(%r14), %rsi
testq %rsi, %rsi
je 0xcb50
movq %rbx, %rdi
callq 0x6d40
testl %eax, %eax
je 0xcb50
movl %eax, %ebp
leaq 0xae99(%rip), %rsi      # 0x179df
movq %rbx, %rdi
movl $0x1c03, %edx           # imm = 0x1C03
jmp 0xcaf0
movq 0x18(%r14), %rdx
testq %rdx, %rdx
je 0xcb80
movq %rbx, %rdi
movl $0x42004d, %esi         # imm = 0x42004D
callq 0x6cb0
testl %eax, %eax
je 0xcb80
movl %eax, %ebp
leaq 0xae6c(%rip), %rsi      # 0x179df
movq %rbx, %rdi
movl $0x1c09, %edx           # imm = 0x1C09
jmp 0xcaf0
movq 0x20(%r14), %rdx
testq %rdx, %rdx
je 0xcbb0
movq %rbx, %rdi
movl $0x42003d, %esi         # imm = 0x42003D
callq 0x6cb0
testl %eax, %eax
je 0xcbb0
movl %eax, %ebp
leaq 0xae3c(%rip), %rsi      # 0x179df
movq %rbx, %rdi
movl $0x1c0f, %edx           # imm = 0x1C0F
jmp 0xcaf0
cmpl $0x0, 0x18(%rbx)
je 0xcbe1
movl 0x28(%r14), %edx
movq %rbx, %rdi
movl $0x4200a3, %esi         # imm = 0x4200A3
callq 0x6700
testl %eax, %eax
je 0xcbe1
movl %eax, %ebp
leaq 0xae0b(%rip), %rsi      # 0x179df
movq %rbx, %rdi
movl $0x1c15, %edx           # imm = 0x1C15
jmp 0xcaf0
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6b10
testl %eax, %eax
je 0xcc11
movl %eax, %ebp
leaq 0xaddb(%rip), %rsi      # 0x179df
movq %rbx, %rdi
movl $0x1c1c, %edx           # imm = 0x1C1C
jmp 0xcaf0
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xcaf5