// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x14(%rbp), %eax
decl %eax
subl $0x5, %eax
ja 0x1b834
jmp 0x1b77a
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 -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x1b7e6
movq -0x10(%rbp), %rdi
movl $0x10, %esi
leaq 0x9f34(%rip), %rdx      # 0x256f4
callq 0x6cd0
movq -0x10(%rbp), %rdi
leaq 0x9f3c(%rip), %rsi      # 0x2570c
movl $0x24e8, %edx           # imm = 0x24E8
callq 0x6f20
movl $0xfffffff4, -0x4(%rbp) # imm = 0xFFFFFFF4
jmp 0x1b923
jmp 0x1b7e8
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rdx
movl $0x420043, %esi         # imm = 0x420043
callq 0x6df0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x1b826
movq -0x10(%rbp), %rdi
leaq 0x9efb(%rip), %rsi      # 0x2570c
movl $0x24ea, %edx           # imm = 0x24EA
callq 0x6f20
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1b923
jmp 0x1b828
movl $0x0, -0x4(%rbp)
jmp 0x1b923
jmp 0x1b836
movl -0x14(%rbp), %eax
movl %eax, -0x28(%rbp)
subl $0x7, %eax
je 0x1b857
jmp 0x1b843
movl -0x28(%rbp), %eax
addl $-0x8, %eax
subl $0xc, %eax
jb 0x1b8fc
jmp 0x1b8fe
movq -0x10(%rbp), %rax
movq 0x868(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x890(%rcx), %rdi
movl $0x1, %esi
movl $0x8, %edx
callq *%rax
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x1b8c0
movq -0x10(%rbp), %rdi
movl $0x8, %esi
leaq 0x9e88(%rip), %rdx      # 0x25725
callq 0x6cd0
movq -0x10(%rbp), %rdi
leaq 0x9e5f(%rip), %rsi      # 0x2570c
movl $0x24f6, %edx           # imm = 0x24F6
callq 0x6f20
movl $0xfffffff4, -0x4(%rbp) # imm = 0xFFFFFFF4
jmp 0x1b923
jmp 0x1b8c2
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
callq 0x6b40
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x1b8f8
movq -0x10(%rbp), %rdi
leaq 0x9e26(%rip), %rsi      # 0x2570c
movl $0x24f8, %edx           # imm = 0x24F8
callq 0x6f20
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1b923
jmp 0x1b8fa
jmp 0x1b91c
jmp 0x1b8fe
movq -0x10(%rbp), %rdi
leaq 0x9e03(%rip), %rsi      # 0x2570c
movl $0x250a, %edx           # imm = 0x250A
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1b923
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)