// File: /workspace/github_c_makefile_star2_O1/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 0xdc77
movl %eax, %ebp
leaq 0x135a0(%rip), %rsi     # 0x2120d
movq %rbx, %rdi
movl $0x1bf2, %edx           # imm = 0x1BF2
jmp 0xdca9
movq 0x8(%rbx), %r12
leaq 0x4(%r12), %r15
movq %r15, 0x8(%rbx)
movl (%r14), %edx
movq %rbx, %rdi
movl $0x42009e, %esi         # imm = 0x42009E
callq 0x66d0
testl %eax, %eax
je 0xdcb9
movl %eax, %ebp
leaq 0x1356c(%rip), %rsi     # 0x2120d
movq %rbx, %rdi
movl $0x1bf8, %edx           # imm = 0x1BF8
callq 0x6de0
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r14), %rsi
testq %rsi, %rsi
je 0xdce1
movq %rbx, %rdi
callq 0x63b0
testl %eax, %eax
je 0xdce1
movl %eax, %ebp
leaq 0x13536(%rip), %rsi     # 0x2120d
movq %rbx, %rdi
movl $0x1bfd, %edx           # imm = 0x1BFD
jmp 0xdca9
movq 0x10(%r14), %rsi
testq %rsi, %rsi
je 0xdd09
movq %rbx, %rdi
callq 0x6ca0
testl %eax, %eax
je 0xdd09
movl %eax, %ebp
leaq 0x1350e(%rip), %rsi     # 0x2120d
movq %rbx, %rdi
movl $0x1c03, %edx           # imm = 0x1C03
jmp 0xdca9
movq 0x18(%r14), %rdx
testq %rdx, %rdx
je 0xdd39
movq %rbx, %rdi
movl $0x42004d, %esi         # imm = 0x42004D
callq 0x6c10
testl %eax, %eax
je 0xdd39
movl %eax, %ebp
leaq 0x134e1(%rip), %rsi     # 0x2120d
movq %rbx, %rdi
movl $0x1c09, %edx           # imm = 0x1C09
jmp 0xdca9
movq 0x20(%r14), %rdx
testq %rdx, %rdx
je 0xdd69
movq %rbx, %rdi
movl $0x42003d, %esi         # imm = 0x42003D
callq 0x6c10
testl %eax, %eax
je 0xdd69
movl %eax, %ebp
leaq 0x134b1(%rip), %rsi     # 0x2120d
movq %rbx, %rdi
movl $0x1c0f, %edx           # imm = 0x1C0F
jmp 0xdca9
cmpl $0x0, 0x18(%rbx)
je 0xdd9a
movl 0x28(%r14), %edx
movq %rbx, %rdi
movl $0x4200a3, %esi         # imm = 0x4200A3
callq 0x66d0
testl %eax, %eax
je 0xdd9a
movl %eax, %ebp
leaq 0x13480(%rip), %rsi     # 0x2120d
movq %rbx, %rdi
movl $0x1c15, %edx           # imm = 0x1C15
jmp 0xdca9
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6a80
testl %eax, %eax
je 0xddca
movl %eax, %ebp
leaq 0x13450(%rip), %rsi     # 0x2120d
movq %rbx, %rdi
movl $0x1c1c, %edx           # imm = 0x1C1C
jmp 0xdca9
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xdcae