// File: /workspace/github_c_makefile_star2_O2/OpenKMIP[P]libkmip/tests/tests.c
// Function: test_decode_symmetric_key
int
test_decode_symmetric_key(TestTracker *tracker)
{
    TRACK_TEST(tracker);

    uint8 encoding[96] = {
        0x42, 0x00, 0x8F, 0x01, 0x00, 0x00, 0x00, 0x58, 
        0x42, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x50, 
        0x42, 0x00, 0x42, 0x05, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x45, 0x01, 0x00, 0x00, 0x00, 0x18, 
        0x42, 0x00, 0x43, 0x08, 0x00, 0x00, 0x00, 0x10, 
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 
        0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 
        0x42, 0x00, 0x28, 0x05, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0x2A, 0x02, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00
    };
    
    struct kmip ctx = {0};
    kmip_init(&ctx, encoding, ARRAY_LENGTH(encoding), KMIP_1_0);
    
    uint8 value[16] = {
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
        0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
    };
    struct byte_string key = {0};
    key.value = value;
    key.size = ARRAY_LENGTH(value);
    
    struct key_value kv = {0};
    kv.key_material = &key;
    
    struct key_block kb = {0};
    kb.key_format_type = KMIP_KEYFORMAT_RAW;
    kb.key_value = &kv;
    kb.key_value_type = KMIP_TYPE_STRUCTURE;
    kb.cryptographic_algorithm = KMIP_CRYPTOALG_AES;
    kb.cryptographic_length = 128;
    
    struct symmetric_key expected = {0};
    expected.key_block = &kb;
    
    struct symmetric_key observed = {0};
    
    int result = kmip_decode_symmetric_key(&ctx, &observed);
    result = report_decoding_test_result(
        tracker,
        &ctx,
        kmip_compare_symmetric_key(&expected, &observed),
        result,
        __func__);
    kmip_free_symmetric_key(&ctx, &observed);
    kmip_destroy(&ctx);
    return(result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x980, %rsp            # imm = 0x980
movq %rdi, %r14
incw (%rdi)
leaq 0x206d6(%rip), %rsi     # 0x29310
pushq $0xc
popq %rcx
leaq 0x80(%rsp), %r15
movq %r15, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xe8(%rsp), %rbx
movl $0x898, %edx            # imm = 0x898
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10c0
pushq $0x60
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x128ed
movaps 0x1d4a7(%rip), %xmm0    # 0x26120
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0x28(%rsp), %rcx
movq %rax, (%rcx)
movq $0x10, 0x8(%rcx)
xorps %xmm0, %xmm0
leaq 0x38(%rsp), %rax
movups %xmm0, 0x8(%rax)
movq %rcx, (%rax)
leaq 0x50(%rsp), %rcx
movaps %xmm0, (%rcx)
andq $0x0, 0x20(%rcx)
movaps %xmm0, 0x10(%rcx)
movl $0x1, (%rcx)
movq %rax, 0x8(%rcx)
movabsq $0x300000001, %rax      # imm = 0x300000001
movq %rax, 0x10(%rcx)
movl $0x80, 0x18(%rcx)
leaq 0x8(%rsp), %r15
movq %rcx, (%r15)
movq %rsp, %r12
andq $0x0, (%r12)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1d96b
movl %eax, %ebp
movq %r15, %rdi
movq %r12, %rsi
callq 0x154b2
leaq 0x1e43b(%rip), %r8      # 0x2713a
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
callq 0x134d
movl %eax, %ebp
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1363a
movq %rbx, %rdi
callq 0x12ade
movl %ebp, %eax
addq $0x980, %rsp            # imm = 0x980
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq