// File: /workspace/github_c_makefile_star2_O0/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_encode_key_material
int
kmip_encode_key_material(KMIP *ctx, enum key_format_type format, const 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:
        result = kmip_encode_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:
        result = kmip_encode_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:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
        
        case KMIP_KEYFORMAT_TRANS_DSA_PUBLIC_KEY:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
        
        case KMIP_KEYFORMAT_TRANS_RSA_PRIVATE_KEY:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
        
        case KMIP_KEYFORMAT_TRANS_RSA_PUBLIC_KEY:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
        
        case KMIP_KEYFORMAT_TRANS_DH_PRIVATE_KEY:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
        
        case KMIP_KEYFORMAT_TRANS_DH_PUBLIC_KEY:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
        
        case KMIP_KEYFORMAT_TRANS_ECDSA_PRIVATE_KEY:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
        
        case KMIP_KEYFORMAT_TRANS_ECDSA_PUBLIC_KEY:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
        
        case KMIP_KEYFORMAT_TRANS_ECDH_PRIVATE_KEY:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
        
        case KMIP_KEYFORMAT_TRANS_ECDH_PUBLIC_KEY:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
        
        case KMIP_KEYFORMAT_TRANS_ECMQV_PRIVATE_KEY:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
        
        case KMIP_KEYFORMAT_TRANS_ECMQV_PUBLIC_KEY:
        kmip_push_error_frame(ctx, __func__, __LINE__);
        return(KMIP_NOT_IMPLEMENTED);
        break;
        
        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 0x1309f
jmp 0x13056
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x420043, %esi         # imm = 0x420043
callq 0x6d40
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x13091
movq -0x10(%rbp), %rdi
leaq 0x11f0b(%rip), %rsi     # 0x24f87
movl $0x1c4a, %edx           # imm = 0x1C4A
callq 0x6f20
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x132ac
jmp 0x13093
movl $0x0, -0x4(%rbp)
jmp 0x132ac
jmp 0x130a1
movl -0x14(%rbp), %eax
addl $-0x7, %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0xc, %eax
ja 0x13287
movq -0x30(%rbp), %rax
leaq 0x117f3(%rip), %rcx     # 0x248b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x6c80
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x13100
movq -0x10(%rbp), %rdi
leaq 0x11e9c(%rip), %rsi     # 0x24f87
movl $0x1c56, %edx           # imm = 0x1C56
callq 0x6f20
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x132ac
jmp 0x13102
jmp 0x132a5
movq -0x10(%rbp), %rdi
leaq 0x11e75(%rip), %rsi     # 0x24f87
movl $0x1c5c, %edx           # imm = 0x1C5C
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movq -0x10(%rbp), %rdi
leaq 0x11e54(%rip), %rsi     # 0x24f87
movl $0x1c61, %edx           # imm = 0x1C61
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movq -0x10(%rbp), %rdi
leaq 0x11e33(%rip), %rsi     # 0x24f87
movl $0x1c66, %edx           # imm = 0x1C66
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movq -0x10(%rbp), %rdi
leaq 0x11e12(%rip), %rsi     # 0x24f87
movl $0x1c6b, %edx           # imm = 0x1C6B
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movq -0x10(%rbp), %rdi
leaq 0x11df1(%rip), %rsi     # 0x24f87
movl $0x1c70, %edx           # imm = 0x1C70
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movq -0x10(%rbp), %rdi
leaq 0x11dd0(%rip), %rsi     # 0x24f87
movl $0x1c75, %edx           # imm = 0x1C75
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movq -0x10(%rbp), %rdi
leaq 0x11daf(%rip), %rsi     # 0x24f87
movl $0x1c7a, %edx           # imm = 0x1C7A
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movq -0x10(%rbp), %rdi
leaq 0x11d8e(%rip), %rsi     # 0x24f87
movl $0x1c7f, %edx           # imm = 0x1C7F
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movq -0x10(%rbp), %rdi
leaq 0x11d6d(%rip), %rsi     # 0x24f87
movl $0x1c84, %edx           # imm = 0x1C84
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movq -0x10(%rbp), %rdi
leaq 0x11d4f(%rip), %rsi     # 0x24f87
movl $0x1c89, %edx           # imm = 0x1C89
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movq -0x10(%rbp), %rdi
leaq 0x11d31(%rip), %rsi     # 0x24f87
movl $0x1c8e, %edx           # imm = 0x1C8E
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movq -0x10(%rbp), %rdi
leaq 0x11d13(%rip), %rsi     # 0x24f87
movl $0x1c93, %edx           # imm = 0x1C93
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movq -0x10(%rbp), %rdi
leaq 0x11cf5(%rip), %rsi     # 0x24f87
movl $0x1c98, %edx           # imm = 0x1C98
callq 0x6f20
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x132ac
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)