// File: /workspace/github_c_makefile_star2_O0/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_decode_key_block
int
kmip_decode_key_block(KMIP *ctx, KeyBlock *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_BLOCK, KMIP_TYPE_STRUCTURE);
    
    kmip_decode_length(ctx, &length);
    CHECK_BUFFER_FULL(ctx, length);
    
    result = kmip_decode_enum(ctx, KMIP_TAG_KEY_FORMAT_TYPE, &value->key_format_type);
    CHECK_RESULT(ctx, result);
    CHECK_ENUM(ctx, KMIP_TAG_KEY_FORMAT_TYPE, value->key_format_type);
    
    if(kmip_is_tag_next(ctx, KMIP_TAG_KEY_COMPRESSION_TYPE))
    {
        result = kmip_decode_enum(ctx, KMIP_TAG_KEY_COMPRESSION_TYPE, &value->key_compression_type);
        CHECK_RESULT(ctx, result);
        CHECK_ENUM(ctx, KMIP_TAG_KEY_COMPRESSION_TYPE, value->key_compression_type);
    }
    
    if(kmip_is_tag_type_next(ctx, KMIP_TAG_KEY_VALUE, KMIP_TYPE_BYTE_STRING))
    {
        value->key_value_type = KMIP_TYPE_BYTE_STRING;
        value->key_value = ctx->calloc_func(ctx->state, 1, sizeof(ByteString));
        CHECK_NEW_MEMORY(ctx, value->key_value, sizeof(ByteString), "KeyValue byte string");
        
        result = kmip_decode_byte_string(ctx, KMIP_TAG_KEY_VALUE, (ByteString *)value->key_value);
    }
    else
    {
        value->key_value_type = KMIP_TYPE_STRUCTURE;
        value->key_value = ctx->calloc_func(ctx->state, 1, sizeof(KeyValue));
        CHECK_NEW_MEMORY(ctx, value->key_value, sizeof(KeyValue), "KeyValue structure");
        
        result = kmip_decode_key_value(ctx, value->key_format_type, (KeyValue *)value->key_value);
    }
    CHECK_RESULT(ctx, result);
    
    if(kmip_is_tag_next(ctx, KMIP_TAG_CRYPTOGRAPHIC_ALGORITHM))
    {
        result = kmip_decode_enum(ctx, KMIP_TAG_CRYPTOGRAPHIC_ALGORITHM, &value->cryptographic_algorithm);
        CHECK_RESULT(ctx, result);
        CHECK_ENUM(ctx, KMIP_TAG_CRYPTOGRAPHIC_ALGORITHM, value->cryptographic_algorithm);
    }
    
    if(kmip_is_tag_next(ctx, KMIP_TAG_CRYPTOGRAPHIC_LENGTH))
    {
        result = kmip_decode_integer(ctx, KMIP_TAG_CRYPTOGRAPHIC_LENGTH, &value->cryptographic_length);
        CHECK_RESULT(ctx, result);
    }
    
    if(kmip_is_tag_next(ctx, KMIP_TAG_KEY_WRAPPING_DATA))
    {
        value->key_wrapping_data = ctx->calloc_func(ctx->state, 1, sizeof(KeyWrappingData));
        CHECK_NEW_MEMORY(ctx, value->key_wrapping_data, sizeof(KeyWrappingData), "KeyWrappingData structure");
        
        result = kmip_decode_key_wrapping_data(ctx, value->key_wrapping_data);
        CHECK_RESULT(ctx, result);
    }
    
    return(KMIP_OK);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%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 0x1c734
movq -0x10(%rbp), %rdi
leaq 0x927a(%rip), %rsi      # 0x25998
movl $0x2684, %edx           # imm = 0x2684
callq 0x6f20
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x1cca3
jmp 0x1c736
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x6b10
movl -0x20(%rbp), %eax
sarl $0x8, %eax
cmpl $0x420040, %eax         # imm = 0x420040
je 0x1c786
movq -0x10(%rbp), %rdi
leaq 0x9228(%rip), %rsi      # 0x25998
movl $0x268b, %edx           # imm = 0x268B
callq 0x6f20
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x1cca3
movl -0x20(%rbp), %eax
andl $0xff, %eax
cmpl $0x1, %eax
je 0x1c7b4
movq -0x10(%rbp), %rdi
leaq 0x91fa(%rip), %rsi      # 0x25998
movl $0x268b, %edx           # imm = 0x268B
callq 0x6f20
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0x1cca3
jmp 0x1c7b6
jmp 0x1c7b8
movq -0x10(%rbp), %rdi
leaq -0x24(%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 -0x24(%rbp), %ecx
cmpq %rcx, %rax
jae 0x1c80b
movq -0x10(%rbp), %rdi
leaq 0x91a3(%rip), %rsi      # 0x25998
movl $0x268e, %edx           # imm = 0x268E
callq 0x6f20
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x1cca3
jmp 0x1c80d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x420042, %esi         # imm = 0x420042
callq 0x6c00
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1c848
movq -0x10(%rbp), %rdi
leaq 0x9165(%rip), %rsi      # 0x25998
movl $0x2691, %edx           # imm = 0x2691
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1cca3
jmp 0x1c84a
jmp 0x1c84c
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
movq -0x18(%rbp), %rax
movl (%rax), %edx
movl $0x420042, %esi         # imm = 0x420042
callq 0x63a0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x1c8a3
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %edx
movl -0x28(%rbp), %ecx
movl $0x420042, %esi         # imm = 0x420042
callq 0x6140
movq -0x10(%rbp), %rdi
leaq 0x910a(%rip), %rsi      # 0x25998
movl $0x2692, %edx           # imm = 0x2692
callq 0x6f20
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1cca3
jmp 0x1c8a5
movq -0x10(%rbp), %rdi
movl $0x420041, %esi         # imm = 0x420041
callq 0x6300
cmpl $0x0, %eax
je 0x1c95c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x4, %rdx
movl $0x420041, %esi         # imm = 0x420041
callq 0x6c00
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1c8fb
movq -0x10(%rbp), %rdi
leaq 0x90b2(%rip), %rsi      # 0x25998
movl $0x2697, %edx           # imm = 0x2697
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1cca3
jmp 0x1c8fd
jmp 0x1c8ff
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
movq -0x18(%rbp), %rax
movl 0x4(%rax), %edx
movl $0x420041, %esi         # imm = 0x420041
callq 0x63a0
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x1c958
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x4(%rax), %edx
movl -0x2c(%rbp), %ecx
movl $0x420041, %esi         # imm = 0x420041
callq 0x6140
movq -0x10(%rbp), %rdi
leaq 0x9055(%rip), %rsi      # 0x25998
movl $0x2698, %edx           # imm = 0x2698
callq 0x6f20
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1cca3
jmp 0x1c95a
jmp 0x1c95c
movq -0x10(%rbp), %rdi
movl $0x420045, %esi         # imm = 0x420045
movl $0x8, %edx
callq 0x68c0
cmpl $0x0, %eax
je 0x1ca11
movq -0x18(%rbp), %rax
movl $0x8, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x868(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x890(%rcx), %rdi
movl $0x1, %esi
movl $0x10, %edx
callq *%rax
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1c9f1
movq -0x10(%rbp), %rdi
movl $0x10, %esi
leaq 0x8fe3(%rip), %rdx      # 0x259ae
callq 0x6cd0
movq -0x10(%rbp), %rdi
leaq 0x8fbd(%rip), %rsi      # 0x25998
movl $0x269f, %edx           # imm = 0x269F
callq 0x6f20
movl $0xfffffff4, -0x4(%rbp) # imm = 0xFFFFFFF4
jmp 0x1cca3
jmp 0x1c9f3
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x420045, %esi         # imm = 0x420045
callq 0x6df0
movl %eax, -0x1c(%rbp)
jmp 0x1caa6
movq -0x18(%rbp), %rax
movl $0x1, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x868(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x890(%rcx), %rdi
movl $0x1, %esi
movl $0x18, %edx
callq *%rax
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1ca8a
movq -0x10(%rbp), %rdi
movl $0x18, %esi
leaq 0x8f5f(%rip), %rdx      # 0x259c3
callq 0x6cd0
movq -0x10(%rbp), %rdi
leaq 0x8f24(%rip), %rsi      # 0x25998
movl $0x26a7, %edx           # imm = 0x26A7
callq 0x6f20
movl $0xfffffff4, -0x4(%rbp) # imm = 0xFFFFFFF4
jmp 0x1cca3
jmp 0x1ca8c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x6c40
movl %eax, -0x1c(%rbp)
jmp 0x1caa8
cmpl $0x0, -0x1c(%rbp)
je 0x1cace
movq -0x10(%rbp), %rdi
leaq 0x8edf(%rip), %rsi      # 0x25998
movl $0x26ab, %edx           # imm = 0x26AB
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1cca3
jmp 0x1cad0
movq -0x10(%rbp), %rdi
movl $0x420028, %esi         # imm = 0x420028
callq 0x6300
cmpl $0x0, %eax
je 0x1cb87
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x14, %rdx
movl $0x420028, %esi         # imm = 0x420028
callq 0x6c00
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1cb26
movq -0x10(%rbp), %rdi
leaq 0x8e87(%rip), %rsi      # 0x25998
movl $0x26b0, %edx           # imm = 0x26B0
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1cca3
jmp 0x1cb28
jmp 0x1cb2a
movq -0x10(%rbp), %rax
movl 0x18(%rax), %edi
movq -0x18(%rbp), %rax
movl 0x14(%rax), %edx
movl $0x420028, %esi         # imm = 0x420028
callq 0x63a0
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x1cb83
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x14(%rax), %edx
movl -0x30(%rbp), %ecx
movl $0x420028, %esi         # imm = 0x420028
callq 0x6140
movq -0x10(%rbp), %rdi
leaq 0x8e2a(%rip), %rsi      # 0x25998
movl $0x26b1, %edx           # imm = 0x26B1
callq 0x6f20
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1cca3
jmp 0x1cb85
jmp 0x1cb87
movq -0x10(%rbp), %rdi
movl $0x42002a, %esi         # imm = 0x42002A
callq 0x6300
cmpl $0x0, %eax
je 0x1cbdd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x18, %rdx
movl $0x42002a, %esi         # imm = 0x42002A
callq 0x60e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1cbd9
movq -0x10(%rbp), %rdi
leaq 0x8dd4(%rip), %rsi      # 0x25998
movl $0x26b7, %edx           # imm = 0x26B7
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1cca3
jmp 0x1cbdb
jmp 0x1cbdd
movq -0x10(%rbp), %rdi
movl $0x420046, %esi         # imm = 0x420046
callq 0x6300
cmpl $0x0, %eax
je 0x1cc9c
movq -0x10(%rbp), %rax
movq 0x868(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x890(%rcx), %rdi
movl $0x1, %esi
movl $0x30, %edx
callq *%rax
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x1cc5f
movq -0x10(%rbp), %rdi
movl $0x30, %esi
leaq 0x8d9a(%rip), %rdx      # 0x259d6
callq 0x6cd0
movq -0x10(%rbp), %rdi
leaq 0x8d4c(%rip), %rsi      # 0x25998
movl $0x26bd, %edx           # imm = 0x26BD
callq 0x6f20
movl $0xfffffff4, -0x4(%rbp) # imm = 0xFFFFFFF4
jmp 0x1cca3
jmp 0x1cc61
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x6d00
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1cc98
movq -0x10(%rbp), %rdi
leaq 0x8d12(%rip), %rsi      # 0x25998
movl $0x26c0, %edx           # imm = 0x26C0
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1cca3
jmp 0x1cc9a
jmp 0x1cc9c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)