// File: /workspace/github_c_makefile_star2_O0/OpenKMIP[P]libkmip/tests/tests.c
// Function: test_encode_protection_storage_masks
int
test_encode_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 expected[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
    };

    uint8 observed[40] = {0};
    KMIP ctx = {0};
    kmip_init(&ctx, observed, ARRAY_LENGTH(observed), 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 psm = {0};
    psm.masks = &list;

    int result = kmip_encode_protection_storage_masks(&ctx, &psm);
    result = report_encoding_test_result(tracker, &ctx, expected, observed, result, __func__);

    kmip_destroy(&ctx);

    return(result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x960, %rsp            # imm = 0x960
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0x30(%rbp), %rdi
leaq 0x39f18(%rip), %rsi     # 0x419d0
movl $0x28, %edx
callq 0x10c0
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x1090
leaq -0x8f8(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x60(%rbp), %rsi
leaq -0x8f8(%rbp), %rdi
movl $0x28, %edx
movl $0x5, %ecx
callq 0x1c6e0
leaq -0x910(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
leaq -0x928(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
movl $0x3fff, -0x92c(%rbp)   # imm = 0x3FFF
leaq -0x92c(%rbp), %rax
movq %rax, -0x918(%rbp)
leaq -0x948(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x1090
movl $0x3, -0x94c(%rbp)
leaq -0x94c(%rbp), %rax
movq %rax, -0x938(%rbp)
leaq -0x910(%rbp), %rdi
leaq -0x928(%rbp), %rsi
callq 0x1b660
leaq -0x910(%rbp), %rdi
leaq -0x948(%rbp), %rsi
callq 0x1b660
leaq -0x958(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0x910(%rbp), %rax
movq %rax, -0x958(%rbp)
leaq -0x8f8(%rbp), %rdi
leaq -0x958(%rbp), %rsi
callq 0x255f0
movl %eax, -0x95c(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rdx
leaq -0x60(%rbp), %rcx
movl -0x95c(%rbp), %r8d
leaq -0x8f8(%rbp), %rsi
leaq 0x37b55(%rip), %r9      # 0x3f73e
callq 0x11f0
movl %eax, -0x95c(%rbp)
leaq -0x8f8(%rbp), %rdi
callq 0x1cab0
movl -0x95c(%rbp), %eax
addq $0x960, %rsp            # imm = 0x960
popq %rbp
retq
nop