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

    /* This encoding matches the following set of values:
    *  Protection Storage Masks
    *      Protection Storage Mask
    *          Software
    *          Hardware
    *          On Processor
    *          On System
    *          Off System
    *          Hypervisor
    *          Operating System
    *          Container
    *          On Premises
    *          Off Premises
    *          Self Managed
    *          Outsourced
    *          Validated
    *          Same Jurisdiction
    *      Protection Storage Mask
    *          Software
    *          Hardware
    */
    uint8 encoding[40] = {
        0x42, 0x01, 0x5F, 0x01, 0x00, 0x00, 0x00, 0x20,
        0x42, 0x01, 0x5E, 0x02, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x3F, 0xFF, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x01, 0x5E, 0x02, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00
    };

    KMIP ctx = {0};
    kmip_init(&ctx, encoding, ARRAY_LENGTH(encoding), KMIP_2_0);

    LinkedList list = {0};
    LinkedListItem item_1 = {0};
    int32 mask_1 = 0x3FFF;
    item_1.data = &mask_1;

    LinkedListItem item_2 = {0};
    int32 mask_2 = 0x0003;
    item_2.data = &mask_2;

    kmip_linked_list_enqueue(&list, &item_1);
    kmip_linked_list_enqueue(&list, &item_2);

    ProtectionStorageMasks expected = {0};
    expected.masks = &list;

    ProtectionStorageMasks observed = {0};
    int result = kmip_decode_protection_storage_masks(&ctx, &observed);
    int comparison = kmip_compare_protection_storage_masks(&expected, &observed);
    if(!comparison)
    {
        kmip_print_protection_storage_masks(stderr, 1, &expected);
        kmip_print_protection_storage_masks(stderr, 1, &observed);
    }
    result = report_decoding_test_result(tracker, &ctx, comparison, result, __func__);

    kmip_free_protection_storage_masks(&ctx, &observed);
    kmip_destroy(&ctx);

    return(result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x948, %rsp            # imm = 0x948
movq %rdi, %rbx
incw (%rdi)
movaps 0x2c201(%rip), %xmm0    # 0x31ab0
leaq 0x80(%rsp), %r15
movaps %xmm0, 0x10(%r15)
movaps 0x2c1dd(%rip), %xmm0    # 0x31aa0
movaps %xmm0, (%r15)
movq $0x3000000, 0x20(%r15)  # imm = 0x3000000
leaq 0xb0(%rsp), %r14
xorl %r13d, %r13d
movl $0x898, %edx            # imm = 0x898
movq %r14, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0x28, %edx
movq %r14, %rdi
movq %r15, %rsi
movl $0x5, %ecx
callq 0x13747
leaq 0x60(%rsp), %r15
movq %r13, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
leaq 0x40(%rsp), %rsi
movq %r13, 0x10(%rsi)
movaps %xmm0, (%rsi)
leaq 0x1c(%rsp), %rax
movl $0x3fff, (%rax)         # imm = 0x3FFF
movq %rax, 0x10(%rsi)
leaq 0x20(%rsp), %r12
movq %r13, 0x10(%r12)
movaps %xmm0, (%r12)
leaq 0x18(%rsp), %rax
movl $0x3, (%rax)
movq %rax, 0x10(%r12)
movq %r15, %rdi
callq 0x12ebd
movq %r15, %rdi
movq %r12, %rsi
callq 0x12ebd
leaq 0x10(%rsp), %r12
movq %r15, (%r12)
leaq 0x8(%rsp), %r15
movq %r13, (%r15)
movq %r14, %rdi
movq %r15, %rsi
callq 0x1dbc0
movl %eax, %ebp
movq %r12, %rdi
movq %r15, %rsi
callq 0x16320
movl %eax, %r14d
testl %eax, %eax
jne 0x59b6
movq 0x3f666(%rip), %r15     # 0x44ff8
movq (%r15), %rdi
leaq 0x10(%rsp), %rdx
movl $0x1, %esi
callq 0x2bdb4
movq (%r15), %rdi
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
callq 0x2bdb4
leaq 0x29e74(%rip), %r8      # 0x2f831
leaq 0xb0(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x1397
movl %eax, %ebx
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x1404e
movq %r15, %rdi
callq 0x13a23
movl %ebx, %eax
addq $0x948, %rsp            # imm = 0x948
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq