// File: /workspace/github_c_makefile_star2_O3/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 0xe132
movl %eax, %ebp
leaq 0x12227(%rip), %rsi     # 0x2034f
movq %rbx, %rdi
movl $0x1d45, %edx           # imm = 0x1D45
jmp 0xe164
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 0xe17a
movl %eax, %ebp
leaq 0x121f3(%rip), %rsi     # 0x2034f
movq %rbx, %rdi
movl $0x1d4b, %edx           # imm = 0x1D4B
callq 0x6de0
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 0xe1a2
movq %rbx, %rdi
callq 0x63b0
testl %eax, %eax
je 0xe1a2
movl %eax, %ebp
leaq 0x121b7(%rip), %rsi     # 0x2034f
movq %rbx, %rdi
movl $0x1d50, %edx           # imm = 0x1D50
jmp 0xe164
movq 0x10(%r14), %rsi
testq %rsi, %rsi
je 0xe1ca
movq %rbx, %rdi
callq 0x6ca0
testl %eax, %eax
je 0xe1ca
movl %eax, %ebp
leaq 0x1218f(%rip), %rsi     # 0x2034f
movq %rbx, %rdi
movl $0x1d56, %edx           # imm = 0x1D56
jmp 0xe164
movq %r15, (%rsp)
cmpq $0x0, 0x20(%r14)
je 0xe200
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0x18(%r14), %rdx
addq %r13, %rdx
movq %rbx, %rdi
movl $0x42000a, %esi         # imm = 0x42000A
callq 0x6670
testl %eax, %eax
jne 0xe262
incq %r15
addq $0x10, %r13
cmpq 0x20(%r14), %r15
jb 0xe1db
cmpl $0x0, 0x18(%rbx)
je 0xe231
movl 0x28(%r14), %edx
movq %rbx, %rdi
movl $0x4200a3, %esi         # imm = 0x4200A3
callq 0x66d0
testl %eax, %eax
je 0xe231
movl %eax, %ebp
leaq 0x1212b(%rip), %rsi     # 0x2034f
movq %rbx, %rdi
movl $0x1d62, %edx           # imm = 0x1D62
jmp 0xe164
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq (%rsp), %rsi
movq %rbx, %rdi
callq 0x6a80
testl %eax, %eax
je 0xe278
movl %eax, %ebp
leaq 0x120fa(%rip), %rsi     # 0x2034f
movq %rbx, %rdi
movl $0x1d69, %edx           # imm = 0x1D69
jmp 0xe164
movl %eax, %ebp
leaq 0x120e4(%rip), %rsi     # 0x2034f
movq %rbx, %rdi
movl $0x1d5c, %edx           # imm = 0x1D5C
jmp 0xe164
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xe169