// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
subq $0x978, %rsp            # imm = 0x978
movq %rdi, %r14
incw (%rdi)
leaq 0x27355(%rip), %rsi     # 0x30310
leaq 0x80(%rsp), %r15
movl $0xc, %ecx
movq %r15, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0xe0(%rsp), %rbx
xorl %r13d, %r13d
movl $0x898, %edx            # imm = 0x898
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0x60, %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x13177
movaps 0x2411f(%rip), %xmm0    # 0x2d120
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)
movaps %xmm0, 0x10(%rcx)
movq %r13, 0x20(%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
movq %r13, (%r12)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x21985
movl %eax, %ebp
movq %r15, %rdi
movq %r12, %rsi
callq 0x164f3
leaq 0x250b5(%rip), %r8      # 0x2e13a
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
callq 0x1363
movl %eax, %ebp
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1421e
movq %rbx, %rdi
callq 0x13455
movl %ebp, %eax
addq $0x978, %rsp            # imm = 0x978
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq