// File: /workspace/github_c_makefile_star2_O1/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_decode_key_material
int
kmip_decode_key_material(KMIP *ctx, enum key_format_type format, void **value)
{
    int result = 0;
    
    switch(format)
    {
        case KMIP_KEYFORMAT_RAW:
        case KMIP_KEYFORMAT_OPAQUE:
        case KMIP_KEYFORMAT_PKCS1:
        case KMIP_KEYFORMAT_PKCS8:
        case KMIP_KEYFORMAT_X509:
        case KMIP_KEYFORMAT_EC_PRIVATE_KEY:
        *value = ctx->calloc_func(ctx->state, 1, sizeof(ByteString));
        CHECK_NEW_MEMORY(ctx, *value, sizeof(ByteString), "KeyMaterial byte string");
        result = kmip_decode_byte_string(ctx, KMIP_TAG_KEY_MATERIAL, (ByteString*)*value);
        CHECK_RESULT(ctx, result);
        return(KMIP_OK);
        break;
        
        default:
        break;
    };
    
    switch(format)
    {
        case KMIP_KEYFORMAT_TRANS_SYMMETRIC_KEY:
        *value = ctx->calloc_func(ctx->state, 1, sizeof(TransparentSymmetricKey));
        CHECK_NEW_MEMORY(ctx, *value, sizeof(TransparentSymmetricKey), "TransparentSymmetricKey structure");
        result = kmip_decode_transparent_symmetric_key(ctx, (TransparentSymmetricKey*)*value);
        CHECK_RESULT(ctx, result);
        break;
        
        /* TODO (ph) The rest require BigInteger support. */
        
        case KMIP_KEYFORMAT_TRANS_DSA_PRIVATE_KEY:
        case KMIP_KEYFORMAT_TRANS_DSA_PUBLIC_KEY:
        case KMIP_KEYFORMAT_TRANS_RSA_PRIVATE_KEY:
        case KMIP_KEYFORMAT_TRANS_RSA_PUBLIC_KEY:
        case KMIP_KEYFORMAT_TRANS_DH_PRIVATE_KEY:
        case KMIP_KEYFORMAT_TRANS_DH_PUBLIC_KEY:
        case KMIP_KEYFORMAT_TRANS_ECDSA_PRIVATE_KEY:
        case KMIP_KEYFORMAT_TRANS_ECDSA_PUBLIC_KEY:
        case KMIP_KEYFORMAT_TRANS_ECDH_PRIVATE_KEY:
        case KMIP_KEYFORMAT_TRANS_ECDH_PUBLIC_KEY:
        case KMIP_KEYFORMAT_TRANS_ECMQV_PRIVATE_KEY:
        case KMIP_KEYFORMAT_TRANS_ECMQV_PUBLIC_KEY:
        default:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
    };
    
    return(KMIP_OK);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rdi, %rbx
leal -0x1(%rsi), %eax
cmpl $0x5, %eax
ja 0x152ec
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movl $0x10, %edx
callq *0x868(%rbx)
movq %rax, (%r14)
testq %rax, %rax
je 0x15334
movq %rbx, %rdi
movl $0x420043, %esi         # imm = 0x420043
movq %rax, %rdx
callq 0x6cc0
testl %eax, %eax
je 0x15354
movl %eax, %ebp
movl $0x24ea, %edx           # imm = 0x24EA
jmp 0x15376
cmpl $0x7, %esi
jne 0x15328
movq 0x890(%rbx), %rdi
movl $0x1, %esi
movl $0x8, %edx
callq *0x868(%rbx)
movq %rax, (%r14)
testq %rax, %rax
je 0x15358
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6a30
testl %eax, %eax
je 0x15354
movl %eax, %ebp
movl $0x24f8, %edx           # imm = 0x24F8
jmp 0x15376
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x250a, %edx           # imm = 0x250A
jmp 0x15376
leaq 0xc55f(%rip), %rdx      # 0x2189a
movl $0x10, %esi
movq %rbx, %rdi
callq 0x6ba0
movl $0xfffffff4, %ebp       # imm = 0xFFFFFFF4
movl $0x24e8, %edx           # imm = 0x24E8
jmp 0x15376
xorl %ebp, %ebp
jmp 0x15385
leaq 0xc56c(%rip), %rdx      # 0x218cb
movl $0x8, %esi
movq %rbx, %rdi
callq 0x6ba0
movl $0xfffffff4, %ebp       # imm = 0xFFFFFFF4
movl $0x24f6, %edx           # imm = 0x24F6
leaq 0xc535(%rip), %rsi      # 0x218b2
movq %rbx, %rdi
callq 0x6de0
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq