// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x940, %rsp            # imm = 0x940
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0x30(%rbp), %rdi
leaq 0x39dc8(%rip), %rsi     # 0x41a00
movl $0x28, %edx
callq 0x10c0
leaq -0x8c8(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x30(%rbp), %rsi
leaq -0x8c8(%rbp), %rdi
movl $0x28, %edx
movl $0x5, %ecx
callq 0x1c6e0
leaq -0x8e0(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
leaq -0x8f8(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
movl $0x3fff, -0x8fc(%rbp)   # imm = 0x3FFF
leaq -0x8fc(%rbp), %rax
movq %rax, -0x8e8(%rbp)
leaq -0x918(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
movl $0x3, -0x91c(%rbp)
leaq -0x91c(%rbp), %rax
movq %rax, -0x908(%rbp)
leaq -0x8e0(%rbp), %rdi
leaq -0x8f8(%rbp), %rsi
callq 0x1b660
leaq -0x8e0(%rbp), %rdi
leaq -0x918(%rbp), %rsi
callq 0x1b660
leaq -0x928(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0x8e0(%rbp), %rax
movq %rax, -0x928(%rbp)
leaq -0x930(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0x8c8(%rbp), %rdi
leaq -0x930(%rbp), %rsi
callq 0x2c210
movl %eax, -0x934(%rbp)
leaq -0x928(%rbp), %rdi
leaq -0x930(%rbp), %rsi
callq 0x20e10
movl %eax, -0x938(%rbp)
cmpl $0x0, -0x938(%rbp)
jne 0x7da3
movq 0x4c284(%rip), %rax     # 0x53ff8
movq (%rax), %rdi
movl $0x1, %esi
leaq -0x928(%rbp), %rdx
callq 0x3b300
movq 0x4c269(%rip), %rax     # 0x53ff8
movq (%rax), %rdi
movl $0x1, %esi
leaq -0x930(%rbp), %rdx
callq 0x3b300
movq -0x8(%rbp), %rdi
movl -0x938(%rbp), %edx
movl -0x934(%rbp), %ecx
leaq -0x8c8(%rbp), %rsi
leaq 0x379a2(%rip), %r8      # 0x3f763
callq 0x13a0
movl %eax, -0x934(%rbp)
leaq -0x8c8(%rbp), %rdi
leaq -0x930(%rbp), %rsi
callq 0x1d810
leaq -0x8c8(%rbp), %rdi
callq 0x1cab0
movl -0x934(%rbp), %eax
addq $0x940, %rsp            # imm = 0x940
popq %rbp
retq
nopw (%rax,%rax)