// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl $0x42004701, %esi       # imm = 0x42004701
callq 0x60b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13abe
movq -0x10(%rbp), %rdi
leaq 0x1156c(%rip), %rsi     # 0x25015
movl $0x1d45, %edx           # imm = 0x1D45
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13cd3
jmp 0x13ac0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rax
addq $0x4, %rax
movq %rax, 0x8(%rcx)
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %edx
movl $0x42009e, %esi         # imm = 0x42009E
callq 0x6770
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13b1d
movq -0x10(%rbp), %rdi
leaq 0x1150d(%rip), %rsi     # 0x25015
movl $0x1d4b, %edx           # imm = 0x1D4B
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13cd3
jmp 0x13b1f
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x13b68
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6400
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13b64
movq -0x10(%rbp), %rdi
leaq 0x114c6(%rip), %rsi     # 0x25015
movl $0x1d50, %edx           # imm = 0x1D50
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13cd3
jmp 0x13b66
jmp 0x13b68
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x13bb1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x6dd0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13bad
movq -0x10(%rbp), %rdi
leaq 0x1147d(%rip), %rsi     # 0x25015
movl $0x1d56, %edx           # imm = 0x1D56
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13cd3
jmp 0x13baf
jmp 0x13bb1
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0x13c23
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x38(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdx
movl $0x42000a, %esi         # imm = 0x42000A
callq 0x66f0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13c11
movq -0x10(%rbp), %rdi
leaq 0x11419(%rip), %rsi     # 0x25015
movl $0x1d5c, %edx           # imm = 0x1D5C
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13cd3
jmp 0x13c13
jmp 0x13c15
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x13bb9
movq -0x10(%rbp), %rax
cmpl $0x1, 0x18(%rax)
jb 0x13c6c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x28(%rax), %edx
movl $0x4200a3, %esi         # imm = 0x4200A3
callq 0x6770
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13c68
movq -0x10(%rbp), %rdi
leaq 0x113bf(%rip), %rsi     # 0x25015
movl $0x1d62, %edx           # imm = 0x1D62
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13cd3
jmp 0x13c6a
jmp 0x13c6c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rax
subq %rax, %rsi
callq 0x6ba0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x13cbe
movq -0x10(%rbp), %rdi
leaq 0x11369(%rip), %rsi     # 0x25015
movl $0x1d69, %edx           # imm = 0x1D69
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13cd3
jmp 0x13cc0
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)