// File: /workspace/github_c_makefile_star2_O2/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 0x11bbd
movq 0x890(%rbx), %rdi
pushq $0x1
popq %rsi
pushq $0x10
popq %rdx
callq *0x868(%rbx)
movq %rax, (%r14)
testq %rax, %rax
je 0x11c1c
movq %rbx, %rdi
movl $0x420043, %esi         # imm = 0x420043
movq %rax, %rdx
callq 0x6d60
testl %eax, %eax
je 0x11c3f
movl %eax, %ebp
leaq 0x65f5(%rip), %rsi      # 0x181a8
movq %rbx, %rdi
movl $0x24ea, %edx           # imm = 0x24EA
jmp 0x11bfd
cmpl $0x7, %esi
jne 0x11c04
movq 0x890(%rbx), %rdi
pushq $0x1
popq %rsi
pushq $0x8
popq %rdx
callq *0x868(%rbx)
movq %rax, (%r14)
testq %rax, %rax
je 0x11c43
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6ab0
testl %eax, %eax
je 0x11c3f
movl %eax, %ebp
leaq 0x65b3(%rip), %rsi      # 0x181a8
movq %rbx, %rdi
movl $0x24f8, %edx           # imm = 0x24F8
callq 0x6e80
jmp 0x11c6c
leaq 0x659d(%rip), %rsi      # 0x181a8
movq %rbx, %rdi
movl $0x250a, %edx           # imm = 0x250A
callq 0x6e80
pushq $-0x1
jmp 0x11c6b
leaq 0x656d(%rip), %rdx      # 0x18190
pushq $0x10
popq %rsi
movq %rbx, %rdi
callq 0x6c40
leaq 0x6573(%rip), %rsi      # 0x181a8
movq %rbx, %rdi
movl $0x24e8, %edx           # imm = 0x24E8
jmp 0x11c64
xorl %ebp, %ebp
jmp 0x11c6c
leaq 0x6577(%rip), %rdx      # 0x181c1
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0x6c40
leaq 0x654c(%rip), %rsi      # 0x181a8
movq %rbx, %rdi
movl $0x24f6, %edx           # imm = 0x24F6
callq 0x6e80
pushq $-0xc
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq