// File: /workspace/github_c_makefile_star2_O1/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
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl $0x42004701, %esi       # imm = 0x42004701
callq 0x60a0
testl %eax, %eax
je 0xe45b
movl %eax, %ebp
leaq 0x12e8e(%rip), %rsi     # 0x212df
movq %rbx, %rdi
movl $0x1d45, %edx           # imm = 0x1D45
jmp 0xe48d
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 0xe4a3
movl %eax, %ebp
leaq 0x12e5a(%rip), %rsi     # 0x212df
movq %rbx, %rdi
movl $0x1d4b, %edx           # imm = 0x1D4B
callq 0x6de0
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r14), %rsi
testq %rsi, %rsi
je 0xe4cb
movq %rbx, %rdi
callq 0x63b0
testl %eax, %eax
je 0xe4cb
movl %eax, %ebp
leaq 0x12e1e(%rip), %rsi     # 0x212df
movq %rbx, %rdi
movl $0x1d50, %edx           # imm = 0x1D50
jmp 0xe48d
movq 0x10(%r14), %rsi
testq %rsi, %rsi
je 0xe4f3
movq %rbx, %rdi
callq 0x6ca0
testl %eax, %eax
je 0xe4f3
movl %eax, %ebp
leaq 0x12df6(%rip), %rsi     # 0x212df
movq %rbx, %rdi
movl $0x1d56, %edx           # imm = 0x1D56
jmp 0xe48d
movq %r12, 0x10(%rsp)
cmpq $0x0, 0x20(%r14)
setne %r13b
je 0xe51c
movq 0x18(%r14), %rdx
movq %rbx, %rdi
movl $0x42000a, %esi         # imm = 0x42000A
callq 0x6670
testl %eax, %eax
je 0xe51e
movl %eax, %ebp
jmp 0xe55f
jmp 0xe573
movq %r15, 0x8(%rsp)
movl $0x10, %edx
xorl %r15d, %r15d
incq %r15
cmpq 0x20(%r14), %r15
setb %r13b
jae 0xe5e2
leaq 0x10(%rdx), %r12
addq 0x18(%r14), %rdx
movq %rbx, %rdi
movl $0x42000a, %esi         # imm = 0x42000A
callq 0x6670
movq %r12, %rdx
testl %eax, %eax
je 0xe52b
movl %eax, %ebp
movq 0x8(%rsp), %r15
leaq 0x12d79(%rip), %rsi     # 0x212df
movq %rbx, %rdi
movl $0x1d5c, %edx           # imm = 0x1D5C
callq 0x6de0
testb %r13b, %r13b
jne 0xe492
cmpl $0x0, 0x18(%rbx)
je 0xe5ad
movl 0x28(%r14), %edx
movq %rbx, %rdi
movl $0x4200a3, %esi         # imm = 0x4200A3
callq 0x66d0
testl %eax, %eax
je 0xe5ad
movl %eax, %ebp
leaq 0x12d3f(%rip), %rsi     # 0x212df
movq %rbx, %rdi
movl $0x1d62, %edx           # imm = 0x1D62
jmp 0xe48d
movq 0x8(%rbx), %r14
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6a80
testl %eax, %eax
je 0xe5e9
movl %eax, %ebp
leaq 0x12d0a(%rip), %rsi     # 0x212df
movq %rbx, %rdi
movl $0x1d69, %edx           # imm = 0x1D69
jmp 0xe48d
movq 0x8(%rsp), %r15
jmp 0xe573
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xe492