// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x9a0, %rsp            # imm = 0x9A0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0x60(%rbp), %rdi
leaq 0x36018(%rip), %rsi     # 0x429d0
movl $0x58, %edx
callq 0x10c0
leaq -0x8f8(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x60(%rbp), %rsi
leaq -0x8f8(%rbp), %rdi
movl $0x58, %edx
xorl %ecx, %ecx
callq 0x1c6e0
movq 0x3a79d(%rip), %rax     # 0x47190
movq %rax, -0x910(%rbp)
movq 0x3a797(%rip), %rax     # 0x47198
movq %rax, -0x908(%rbp)
leaq -0x920(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0x910(%rbp), %rax
movq %rax, -0x920(%rbp)
movq $0x10, -0x918(%rbp)
leaq -0x938(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
leaq -0x920(%rbp), %rax
movq %rax, -0x938(%rbp)
leaq -0x960(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x1090
leaq -0x960(%rbp), %rdi
callq 0x1d450
movl $0x1, -0x960(%rbp)
leaq -0x938(%rbp), %rax
movq %rax, -0x958(%rbp)
movl $0x1, -0x950(%rbp)
movl $0x3, -0x94c(%rbp)
movl $0x80, -0x948(%rbp)
leaq -0x988(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x1090
leaq -0x988(%rbp), %rdi
callq 0x1d450
leaq -0x8f8(%rbp), %rdi
leaq -0x988(%rbp), %rsi
callq 0x30b40
movl %eax, -0x98c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x998(%rbp)
leaq -0x960(%rbp), %rdi
leaq -0x988(%rbp), %rsi
callq 0x21fc0
movq -0x998(%rbp), %rdi
movl %eax, %edx
movl -0x98c(%rbp), %ecx
leaq -0x8f8(%rbp), %rsi
leaq 0x33521(%rip), %r8      # 0x4003e
callq 0x13a0
movl %eax, -0x98c(%rbp)
leaq -0x8f8(%rbp), %rdi
leaq -0x988(%rbp), %rsi
callq 0x1e230
leaq -0x8f8(%rbp), %rdi
callq 0x1cab0
movl -0x98c(%rbp), %eax
addq $0x9a0, %rsp            # imm = 0x9A0
popq %rbp
retq
nopw %cs:(%rax,%rax)