// File: /workspace/github_c_makefile_star2_O3/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 0xd999
movl %eax, %ebp
leaq 0x128ee(%rip), %rsi     # 0x2027d
movq %rbx, %rdi
movl $0x1bf2, %edx           # imm = 0x1BF2
jmp 0xd9cb
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 0xd9db
movl %eax, %ebp
leaq 0x128ba(%rip), %rsi     # 0x2027d
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 0xda03
movq %rbx, %rdi
callq 0x63b0
testl %eax, %eax
je 0xda03
movl %eax, %ebp
leaq 0x12884(%rip), %rsi     # 0x2027d
movq %rbx, %rdi
movl $0x1bfd, %edx           # imm = 0x1BFD
jmp 0xd9cb
movq 0x10(%r14), %rsi
testq %rsi, %rsi
je 0xda2b
movq %rbx, %rdi
callq 0x6ca0
testl %eax, %eax
je 0xda2b
movl %eax, %ebp
leaq 0x1285c(%rip), %rsi     # 0x2027d
movq %rbx, %rdi
movl $0x1c03, %edx           # imm = 0x1C03
jmp 0xd9cb
movq 0x18(%r14), %rdx
testq %rdx, %rdx
je 0xda5b
movq %rbx, %rdi
movl $0x42004d, %esi         # imm = 0x42004D
callq 0x6c10
testl %eax, %eax
je 0xda5b
movl %eax, %ebp
leaq 0x1282f(%rip), %rsi     # 0x2027d
movq %rbx, %rdi
movl $0x1c09, %edx           # imm = 0x1C09
jmp 0xd9cb
movq 0x20(%r14), %rdx
testq %rdx, %rdx
je 0xda8b
movq %rbx, %rdi
movl $0x42003d, %esi         # imm = 0x42003D
callq 0x6c10
testl %eax, %eax
je 0xda8b
movl %eax, %ebp
leaq 0x127ff(%rip), %rsi     # 0x2027d
movq %rbx, %rdi
movl $0x1c0f, %edx           # imm = 0x1C0F
jmp 0xd9cb
cmpl $0x0, 0x18(%rbx)
je 0xdabc
movl 0x28(%r14), %edx
movq %rbx, %rdi
movl $0x4200a3, %esi         # imm = 0x4200A3
callq 0x66d0
testl %eax, %eax
je 0xdabc
movl %eax, %ebp
leaq 0x127ce(%rip), %rsi     # 0x2027d
movq %rbx, %rdi
movl $0x1c15, %edx           # imm = 0x1C15
jmp 0xd9cb
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6a80
testl %eax, %eax
je 0xdaec
movl %eax, %ebp
leaq 0x1279e(%rip), %rsi     # 0x2027d
movq %rbx, %rdi
movl $0x1c1c, %edx           # imm = 0x1C1C
jmp 0xd9cb
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xd9d0