// File: /workspace/github_c_makefile_star2_O0/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_decode_key_value
int
kmip_decode_key_value(KMIP *ctx, enum key_format_type format, KeyValue *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_VALUE, KMIP_TYPE_STRUCTURE);
    
    kmip_decode_length(ctx, &length);
    CHECK_BUFFER_FULL(ctx, length);
    
    result = kmip_decode_key_material(ctx, format, &value->key_material);
    CHECK_RESULT(ctx, result);
    
    value->attribute_count = kmip_get_num_items_next(ctx, KMIP_TAG_ATTRIBUTE);
    if(value->attribute_count > 0)
    {
        value->attributes = ctx->calloc_func(ctx->state, value->attribute_count, sizeof(Attribute));
        CHECK_NEW_MEMORY(ctx, value->attributes, value->attribute_count * sizeof(Attribute), "sequence of Attribute structures");
        
        for(size_t i = 0; i < value->attribute_count; i++)
        {
            result = kmip_decode_attribute(ctx, &value->attributes[i]);
            CHECK_RESULT(ctx, result);
        }
    }
    
    return(KMIP_OK);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x10(%rbp), %rdx
movq (%rdx), %rdx
subq %rdx, %rcx
subq %rcx, %rax
cmpq $0x8, %rax
jae 0x1b987
movq -0x10(%rbp), %rdi
leaq 0x9dd6(%rip), %rsi      # 0x25747
movl $0x2515, %edx           # imm = 0x2515
callq 0x6f20
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x1bbad
jmp 0x1b989
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x6b10
movl -0x28(%rbp), %eax
sarl $0x8, %eax
cmpl $0x420045, %eax         # imm = 0x420045
je 0x1b9d9
movq -0x10(%rbp), %rdi
leaq 0x9d84(%rip), %rsi      # 0x25747
movl $0x251c, %edx           # imm = 0x251C
callq 0x6f20
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x1bbad
movl -0x28(%rbp), %eax
andl $0xff, %eax
cmpl $0x1, %eax
je 0x1ba07
movq -0x10(%rbp), %rdi
leaq 0x9d56(%rip), %rsi      # 0x25747
movl $0x251c, %edx           # imm = 0x251C
callq 0x6f20
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0x1bbad
jmp 0x1ba09
jmp 0x1ba0b
movq -0x10(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x6520
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x10(%rbp), %rdx
movq (%rdx), %rdx
subq %rdx, %rcx
subq %rcx, %rax
movl -0x2c(%rbp), %ecx
cmpq %rcx, %rax
jae 0x1ba5e
movq -0x10(%rbp), %rdi
leaq 0x9cff(%rip), %rsi      # 0x25747
movl $0x251f, %edx           # imm = 0x251F
callq 0x6f20
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x1bbad
jmp 0x1ba60
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
callq 0x6e70
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x1ba99
movq -0x10(%rbp), %rdi
leaq 0x9cc3(%rip), %rsi      # 0x25747
movl $0x2522, %edx           # imm = 0x2522
callq 0x6f20
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1bbad
jmp 0x1ba9b
movq -0x10(%rbp), %rdi
movl $0x420008, %esi         # imm = 0x420008
callq 0x6340
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jbe 0x1bba6
movq -0x10(%rbp), %rax
movq 0x868(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x890(%rcx), %rdi
movq -0x20(%rbp), %rcx
movq 0x10(%rcx), %rsi
movl $0x10, %edx
callq *%rax
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1bb38
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
shlq $0x4, %rsi
leaq 0x9b6b(%rip), %rdx      # 0x25680
callq 0x6cd0
movq -0x10(%rbp), %rdi
leaq 0x9c22(%rip), %rsi      # 0x25747
movl $0x2528, %edx           # imm = 0x2528
callq 0x6f20
movl $0xfffffff4, -0x4(%rbp) # imm = 0xFFFFFFF4
jmp 0x1bbad
jmp 0x1bb3a
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x1bba4
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x38(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x68a0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x1bb92
movq -0x10(%rbp), %rdi
leaq 0x9bc7(%rip), %rsi      # 0x25747
movl $0x252d, %edx           # imm = 0x252D
callq 0x6f20
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1bbad
jmp 0x1bb94
jmp 0x1bb96
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x1bb42
jmp 0x1bba6
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)