// File: /workspace/github_c_makefile_star2_O2/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_decode_key_wrapping_specification
int
kmip_decode_key_wrapping_specification(KMIP *ctx, KeyWrappingSpecification *value)
{
    CHECK_BUFFER_FULL(ctx, 8);
    
    int result = 0;
    int32 tag_type = 0;
    uint32 length = 0;
    
    kmip_decode_int32_be(ctx, &tag_type);
    CHECK_TAG_TYPE(ctx, tag_type, KMIP_TAG_KEY_WRAPPING_SPECIFICATION, KMIP_TYPE_STRUCTURE);
    
    kmip_decode_length(ctx, &length);
    CHECK_BUFFER_FULL(ctx, length);
    
    result = kmip_decode_enum(ctx, KMIP_TAG_WRAPPING_METHOD, &value->wrapping_method);
    CHECK_RESULT(ctx, result);
    CHECK_ENUM(ctx, KMIP_TAG_WRAPPING_METHOD, value->wrapping_method);
    
    if(kmip_is_tag_next(ctx, KMIP_TAG_ENCRYPTION_KEY_INFORMATION))
    {
        value->encryption_key_info = ctx->calloc_func(ctx->state, 1, sizeof(EncryptionKeyInformation));
        CHECK_NEW_MEMORY(ctx, value->encryption_key_info, sizeof(EncryptionKeyInformation), "EncryptionKeyInformation structure");
        result = kmip_decode_encryption_key_information(ctx, value->encryption_key_info);
        CHECK_RESULT(ctx, result);
    }
    
    if(kmip_is_tag_next(ctx, KMIP_TAG_MAC_SIGNATURE_KEY_INFORMATION))
    {
        value->mac_signature_key_info = ctx->calloc_func(ctx->state, 1, sizeof(MACSignatureKeyInformation));
        CHECK_NEW_MEMORY(ctx, value->mac_signature_key_info, sizeof(MACSignatureKeyInformation), "MACSignatureKeyInformation structure");
        result = kmip_decode_mac_signature_key_information(ctx, value->mac_signature_key_info);
        CHECK_RESULT(ctx, result);
    }
    
    value->attribute_name_count = kmip_get_num_items_next(ctx, KMIP_TAG_ATTRIBUTE_NAME);
    if(value->attribute_name_count > 0)
    {
        value->attribute_names = ctx->calloc_func(ctx->state, value->attribute_name_count, sizeof(TextString));
        CHECK_NEW_MEMORY(ctx, value->attribute_names, value->attribute_name_count * sizeof(TextString), "sequence of AttributeName text strings");
        
        for(size_t i = 0; i < value->attribute_name_count; i++)
        {
            result = kmip_decode_text_string(ctx, KMIP_TAG_ATTRIBUTE_NAME, &value->attribute_names[i]);
            CHECK_RESULT(ctx, result);
        }
    }
    
    if(ctx->version >= KMIP_1_1)
    {
        result = kmip_decode_enum(ctx, KMIP_TAG_ENCODING_OPTION, &value->encoding_option);
        CHECK_RESULT(ctx, result);
        CHECK_ENUM(ctx, KMIP_TAG_ENCODING_OPTION, value->encoding_option);
    }
    
    return(KMIP_OK);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x10(%rdi), %rax
subq 0x8(%rdi), %rax
addq (%rdi), %rax
cmpq $0x7, %rax
ja 0x12ab0
leaq 0x5a4a(%rip), %rsi      # 0x184e8
movq %rbx, %rdi
movl $0x2711, %edx           # imm = 0x2711
callq 0x6e80
pushq $-0x2
popq %rbp
jmp 0x12b2b
movq %rsi, %r14
leaq 0xc(%rsp), %r15
andl $0x0, (%r15)
andl $0x0, 0x8(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6a80
movl (%r15), %eax
movl %eax, %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
movl $0x2718, %edx           # imm = 0x2718
cmpl $0x42004700, %ecx       # imm = 0x42004700
jne 0x12b15
cmpb $0x1, %al
jne 0x12b19
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x64d0
movq 0x10(%rbx), %rax
subq 0x8(%rbx), %rax
addq (%rbx), %rax
movl (%r15), %ecx
cmpq %rcx, %rax
jae 0x12b3a
pushq $-0x2
popq %rbp
movl $0x271b, %edx           # imm = 0x271B
jmp 0x12b1c
pushq $-0x4
jmp 0x12b1b
pushq $-0x5
popq %rbp
leaq 0x59c5(%rip), %rsi      # 0x184e8
movq %rbx, %rdi
callq 0x6e80
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movl $0x42009e, %esi         # imm = 0x42009E
movq %r14, %rdx
callq 0x6b70
testl %eax, %eax
je 0x12b57
movl %eax, %ebp
movl $0x271e, %edx           # imm = 0x271E
jmp 0x12b1c
movl (%r14), %edx
leal -0x1(%rdx), %eax
cmpl $0x5, %eax
jae 0x12bae
movq %rbx, %rdi
movl $0x420036, %esi         # imm = 0x420036
callq 0x62d0
testl %eax, %eax
je 0x12bca
movq 0x890(%rbx), %rdi
pushq $0x1
popq %rsi
pushq $0x10
popq %rdx
callq *0x868(%rbx)
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x12c86
movq %rbx, %rdi
movq %rax, %rsi
callq 0x60f0
testl %eax, %eax
je 0x12bca
movl %eax, %ebp
movl $0x2726, %edx           # imm = 0x2726
jmp 0x12b1c
pushq $-0x9
popq %rbp
movq %rbx, %rdi
movl $0x42009e, %esi         # imm = 0x42009E
movl %ebp, %ecx
callq 0x6120
movl $0x271f, %edx           # imm = 0x271F
jmp 0x12b1c
movq %rbx, %rdi
movl $0x42004e, %esi         # imm = 0x42004E
callq 0x62d0
testl %eax, %eax
je 0x12c16
movq 0x890(%rbx), %rdi
pushq $0x1
popq %rsi
pushq $0x10
popq %rdx
callq *0x868(%rbx)
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0x12cd5
movq %rbx, %rdi
movq %rax, %rsi
callq 0x63c0
testl %eax, %eax
je 0x12c16
movl %eax, %ebp
movl $0x272e, %edx           # imm = 0x272E
jmp 0x12b1c
movq %rbx, %rdi
movl $0x42000a, %esi         # imm = 0x42000A
callq 0x6310
movq %rax, 0x20(%r14)
testq %rax, %rax
je 0x12ca5
movq 0x890(%rbx), %rdi
pushq $0x10
popq %rdx
movq %rax, %rsi
callq *0x868(%rbx)
movq %rax, 0x18(%r14)
testq %rax, %rax
je 0x12cf4
pushq $-0x1
popq %r15
xorl %eax, %eax
incq %r15
cmpq 0x20(%r14), %r15
jae 0x12ca5
leaq 0x10(%rax), %r12
addq 0x18(%r14), %rax
movq %rbx, %rdi
movl $0x42000a, %esi         # imm = 0x42000A
movq %rax, %rdx
callq 0x6560
movl %eax, %ebp
movl $0x273a, %edx           # imm = 0x273A
movq %r12, %rax
testl %ebp, %ebp
je 0x12c52
jmp 0x12b1c
leaq 0x5727(%rip), %rdx      # 0x183b4
pushq $0x10
popq %rsi
movq %rbx, %rdi
callq 0x6c40
pushq $-0xc
popq %rbp
movl $0x2724, %edx           # imm = 0x2724
jmp 0x12b1c
xorl %ebp, %ebp
cmpl $0x0, 0x18(%rbx)
je 0x12b2b
addq $0x28, %r14
movq %rbx, %rdi
movl $0x4200a3, %esi         # imm = 0x4200A3
movq %r14, %rdx
callq 0x6b70
testl %eax, %eax
je 0x12d18
movl $0x2741, %edx           # imm = 0x2741
movl %eax, %ebp
jmp 0x12b1c
leaq 0x5833(%rip), %rdx      # 0x1850f
pushq $0x10
popq %rsi
movq %rbx, %rdi
callq 0x6c40
pushq $-0xc
popq %rbp
movl $0x272c, %edx           # imm = 0x272C
jmp 0x12b1c
movq 0x20(%r14), %rsi
shlq $0x4, %rsi
leaq 0x5831(%rip), %rdx      # 0x18534
movq %rbx, %rdi
callq 0x6c40
pushq $-0xc
popq %rbp
movl $0x2735, %edx           # imm = 0x2735
jmp 0x12b1c
movl (%r14), %edx
leal -0x1(%rdx), %eax
cmpl $0x1, %eax
ja 0x12d31
cmpl $0x0, 0x18(%rbx)
jne 0x12b2b
pushq $-0xb
jmp 0x12d33
pushq $-0x9
popq %rbp
movq %rbx, %rdi
movl $0x4200a3, %esi         # imm = 0x4200A3
movl %ebp, %ecx
callq 0x6120
movl $0x2742, %edx           # imm = 0x2742
jmp 0x12b1c