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

    uint8 encoding[88] = {
        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, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
        0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 
        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, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
        0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
    };
    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 expected = {0};
    kmip_init_key_block(&expected);
    
    expected.key_format_type = KMIP_KEYFORMAT_RAW;
    expected.key_value = &kv;
    expected.key_value_type = KMIP_TYPE_STRUCTURE;
    expected.cryptographic_algorithm = KMIP_CRYPTOALG_AES;
    expected.cryptographic_length = 128;
    
    struct key_block observed = {0};
    kmip_init_key_block(&observed);
    
    int result = kmip_decode_key_block(&ctx, &observed);
    result = report_decoding_test_result(
        tracker,
        &ctx,
        kmip_compare_key_block(&expected, &observed),
        result,
        __func__);
    kmip_free_key_block(&ctx, &observed);
    kmip_destroy(&ctx);
    return(result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x998, %rsp            # imm = 0x998
movq %rdi, %r14
incw (%rdi)
leaq 0x29326(%rip), %rsi     # 0x322c0
leaq 0xa0(%rsp), %r15
movl $0xb, %ecx
movq %r15, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x100(%rsp), %rbx
xorl %r13d, %r13d
movl $0x898, %edx            # imm = 0x898
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0x58, %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x13747
movaps 0x26130(%rip), %xmm0    # 0x2f110
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
xorps %xmm0, %xmm0
movq %rsp, %rcx
movaps %xmm0, (%rcx)
movq %rax, (%rcx)
movq $0x10, 0x8(%rcx)
leaq 0x20(%rsp), %r15
movaps %xmm0, (%r15)
movq %r13, 0x10(%r15)
movq %rcx, (%r15)
leaq 0x70(%rsp), %r12
movq %r13, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq %r12, %rdi
callq 0x13ea1
movl $0x1, (%r12)
movq %r15, 0x8(%r12)
movabsq $0x300000001, %rax      # imm = 0x300000001
movq %rax, 0x10(%r12)
movl $0x80, 0x18(%r12)
leaq 0x40(%rsp), %r15
movq %r13, 0x20(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movq %r15, %rdi
callq 0x13ea1
movq %rbx, %rdi
movq %r15, %rsi
callq 0x222c0
movl %eax, %ebp
movq %r12, %rdi
movq %r15, %rsi
callq 0x16b3d
leaq 0x2706c(%rip), %r8      # 0x300f6
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
callq 0x1397
movl %eax, %ebp
movq %rbx, %rdi
movq %r15, %rsi
callq 0x14717
movq %rbx, %rdi
callq 0x13a23
movl %ebp, %eax
addq $0x998, %rsp            # imm = 0x998
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq