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

    uint8 encoding[192] = {
        0x42, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0xB8, 
        0x42, 0x00, 0x42, 0x05, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x45, 0x08, 0x00, 0x00, 0x00, 0x18, 
        0x1F, 0xA6, 0x8B, 0x0A, 0x81, 0x12, 0xB4, 0x47, 
        0xAE, 0xF3, 0x4B, 0xD8, 0xFB, 0x5A, 0x7B, 0x82, 
        0x9D, 0x3E, 0x86, 0x23, 0x71, 0xD2, 0xCF, 0xE5, 
        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, 
        0x42, 0x00, 0x46, 0x01, 0x00, 0x00, 0x00, 0x60, 
        0x42, 0x00, 0x9E, 0x05, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x36, 0x01, 0x00, 0x00, 0x00, 0x48, 
        0x42, 0x00, 0x94, 0x07, 0x00, 0x00, 0x00, 0x24,
        0x31, 0x30, 0x30, 0x31, 0x38, 0x32, 0x64, 0x35, 
        0x2D, 0x37, 0x32, 0x62, 0x38, 0x2D, 0x34, 0x37, 
        0x61, 0x61, 0x2D, 0x38, 0x33, 0x38, 0x33, 0x2D, 
        0x34, 0x64, 0x39, 0x37, 0x64, 0x35, 0x31, 0x32, 
        0x65, 0x39, 0x38, 0x61, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x2B, 0x01, 0x00, 0x00, 0x00, 0x10, 
        0x42, 0x00, 0x11, 0x05, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00
    };
    
    struct kmip ctx = {0};
    kmip_init(&ctx, encoding, ARRAY_LENGTH(encoding), KMIP_1_0);
    
    uint8 value[24] = {
        0x1F, 0xA6, 0x8B, 0x0A, 0x81, 0x12, 0xB4, 0x47,
        0xAE, 0xF3, 0x4B, 0xD8, 0xFB, 0x5A, 0x7B, 0x82,
        0x9D, 0x3E, 0x86, 0x23, 0x71, 0xD2, 0xCF, 0xE5
    };
    struct byte_string key = {0};
    key.value = value;
    key.size = ARRAY_LENGTH(value);
    
    struct text_string uuid = {0};
    uuid.value = "100182d5-72b8-47aa-8383-4d97d512e98a";
    uuid.size = 36;
    
    struct cryptographic_parameters cp = {0};
    kmip_init_cryptographic_parameters(&cp);
    
    cp.block_cipher_mode = KMIP_BLOCK_NIST_KEY_WRAP;
    
    struct encryption_key_information eki = {0};
    eki.unique_identifier = &uuid;
    eki.cryptographic_parameters = &cp;
    
    struct key_wrapping_data kwd = {0};
    kwd.wrapping_method = KMIP_WRAP_ENCRYPT;
    kwd.encryption_key_info = &eki;
    
    struct key_block expected = {0};
    kmip_init_key_block(&expected);
    
    expected.key_format_type = KMIP_KEYFORMAT_RAW;
    expected.key_value = &key;
    expected.key_value_type = KMIP_TYPE_BYTE_STRING;
    expected.cryptographic_algorithm = KMIP_CRYPTOALG_AES;
    expected.cryptographic_length = 128;
    expected.key_wrapping_data = &kwd;
    
    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 $0xa90, %rsp            # imm = 0xA90
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0xd0(%rbp), %rdi
leaq 0x362d5(%rip), %rsi     # 0x42890
movl $0xc0, %edx
callq 0x10c0
leaq -0x968(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0xd0(%rbp), %rsi
leaq -0x968(%rbp), %rdi
movl $0xc0, %edx
xorl %ecx, %ecx
callq 0x1c6e0
movq 0x36357(%rip), %rax     # 0x42950
movq %rax, -0x980(%rbp)
movq 0x36351(%rip), %rax     # 0x42958
movq %rax, -0x978(%rbp)
movq 0x3634b(%rip), %rax     # 0x42960
movq %rax, -0x970(%rbp)
leaq -0x990(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0x980(%rbp), %rax
movq %rax, -0x990(%rbp)
movq $0x18, -0x988(%rbp)
leaq -0x9a0(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq 0x3372f(%rip), %rax     # 0x3fd91
movq %rax, -0x9a0(%rbp)
movq $0x24, -0x998(%rbp)
leaq -0x9f0(%rbp), %rdi
xorl %esi, %esi
movl $0x50, %edx
callq 0x1090
leaq -0x9f0(%rbp), %rdi
callq 0x1d370
movl $0xd, -0x9f0(%rbp)
leaq -0xa00(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0x9a0(%rbp), %rax
movq %rax, -0xa00(%rbp)
leaq -0x9f0(%rbp), %rax
movq %rax, -0x9f8(%rbp)
leaq -0xa30(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x1090
movl $0x1, -0xa30(%rbp)
leaq -0xa00(%rbp), %rax
movq %rax, -0xa28(%rbp)
leaq -0xa58(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x1090
leaq -0xa58(%rbp), %rdi
callq 0x1d450
movl $0x1, -0xa58(%rbp)
leaq -0x990(%rbp), %rax
movq %rax, -0xa50(%rbp)
movl $0x8, -0xa48(%rbp)
movl $0x3, -0xa44(%rbp)
movl $0x80, -0xa40(%rbp)
leaq -0xa30(%rbp), %rax
movq %rax, -0xa38(%rbp)
leaq -0xa80(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x1090
leaq -0xa80(%rbp), %rdi
callq 0x1d450
leaq -0x968(%rbp), %rdi
leaq -0xa80(%rbp), %rsi
callq 0x30b40
movl %eax, -0xa84(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa90(%rbp)
leaq -0xa58(%rbp), %rdi
leaq -0xa80(%rbp), %rsi
callq 0x21fc0
movq -0xa90(%rbp), %rdi
movl %eax, %edx
movl -0xa84(%rbp), %ecx
leaq -0x968(%rbp), %rsi
leaq 0x3381b(%rip), %r8      # 0x3ffe8
callq 0x13a0
movl %eax, -0xa84(%rbp)
leaq -0x968(%rbp), %rdi
leaq -0xa80(%rbp), %rsi
callq 0x1e230
leaq -0x968(%rbp), %rdi
callq 0x1cab0
movl -0xa84(%rbp), %eax
addq $0xa90, %rsp            # imm = 0xA90
popq %rbp
retq
nopw %cs:(%rax,%rax)