// File: /workspace/github_c_makefile_star2_O2/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_encode_key_wrapping_specification
int
kmip_encode_key_wrapping_specification(KMIP *ctx, const KeyWrappingSpecification *value)
{
    int result = 0;
    result = kmip_encode_int32_be(ctx, TAG_TYPE(KMIP_TAG_KEY_WRAPPING_SPECIFICATION, 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);
    }
    
    for(size_t i = 0; i < value->attribute_name_count; i++)
    {
        result = kmip_encode_text_string(ctx, KMIP_TAG_ATTRIBUTE_NAME, &value->attribute_names[i]);
        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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl $0x42004701, %esi       # imm = 0x42004701
callq 0x60a0
testl %eax, %eax
je 0xd25c
movl %eax, %ebp
leaq 0xa85f(%rip), %rsi      # 0x17ab1
movq %rbx, %rdi
movl $0x1d45, %edx           # imm = 0x1D45
jmp 0xd28e
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 0xd2a4
movl %eax, %ebp
leaq 0xa82b(%rip), %rsi      # 0x17ab1
movq %rbx, %rdi
movl $0x1d4b, %edx           # imm = 0x1D4B
callq 0x6e80
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r14), %rsi
testq %rsi, %rsi
je 0xd2cc
movq %rbx, %rdi
callq 0x63d0
testl %eax, %eax
je 0xd2cc
movl %eax, %ebp
leaq 0xa7ef(%rip), %rsi      # 0x17ab1
movq %rbx, %rdi
movl $0x1d50, %edx           # imm = 0x1D50
jmp 0xd28e
movq 0x10(%r14), %rsi
testq %rsi, %rsi
je 0xd2f4
movq %rbx, %rdi
callq 0x6d40
testl %eax, %eax
je 0xd2f4
movl %eax, %ebp
leaq 0xa7c7(%rip), %rsi      # 0x17ab1
movq %rbx, %rdi
movl $0x1d56, %edx           # imm = 0x1D56
jmp 0xd28e
movq %r15, (%rsp)
pushq $-0x1
popq %r13
xorl %edx, %edx
incq %r13
cmpq 0x20(%r14), %r13
jae 0xd339
leaq 0x10(%rdx), %r15
addq 0x18(%r14), %rdx
movq %rbx, %rdi
movl $0x42000a, %esi         # imm = 0x42000A
callq 0x66a0
movq %r15, %rdx
testl %eax, %eax
je 0xd2fe
movl %eax, %ebp
leaq 0xa785(%rip), %rsi      # 0x17ab1
movq %rbx, %rdi
movl $0x1d5c, %edx           # imm = 0x1D5C
jmp 0xd28e
cmpl $0x0, 0x18(%rbx)
je 0xd36a
movl 0x28(%r14), %edx
movq %rbx, %rdi
movl $0x4200a3, %esi         # imm = 0x4200A3
callq 0x6700
testl %eax, %eax
je 0xd36a
movl %eax, %ebp
leaq 0xa754(%rip), %rsi      # 0x17ab1
movq %rbx, %rdi
movl $0x1d62, %edx           # imm = 0x1D62
jmp 0xd28e
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq (%rsp), %rsi
movq %rbx, %rdi
callq 0x6b10
testl %eax, %eax
je 0xd39b
movl %eax, %ebp
leaq 0xa723(%rip), %rsi      # 0x17ab1
movq %rbx, %rdi
movl $0x1d69, %edx           # imm = 0x1D69
jmp 0xd28e
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xd293