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

    uint8 encoding[144] = {
        0x42, 0x00, 0x94, 0x07, 0x00, 0x00, 0x00, 0x26,
        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, 0x11, 0x11, 0x00, 0x00, 
        0x42, 0x00, 0x94, 0x07, 0x00, 0x00, 0x00, 0x25,
        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, 0x11, 0x00, 0x00, 0x00, 
        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
    };

    struct kmip ctx = {0};
    kmip_init(&ctx, encoding, ARRAY_LENGTH(encoding), KMIP_1_0);
    
    uint8 *before = ctx.index;
    int result = 0;
    size_t count = 0;
    
    count = kmip_get_num_items_next(&ctx, KMIP_TAG_UNIQUE_IDENTIFIER);
    if(count != 3)
    {
        printf("FAIL - %s\n", __func__);
        printf("- expected item count not found (exp. 3, obs. %zu)\n",
               count);
        tracker->tests_failed++;
        result = 1;
    }
    
    uint8 *after = ctx.index;
    
    if(before != after)
    {
        printf("FAIL - %s\n", __func__);
        printf("- item count checking modifies context buffer index\n");
        tracker->tests_failed++;
        result = 1;
    }
    
    kmip_destroy(&ctx);
    
    if(result == 0)
    {
        printf("PASS - %s\n", __func__);
        tracker->tests_passed++;
    }
    
    return(result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x930, %rsp            # imm = 0x930
movq %rdi, %rbx
incw (%rdi)
leaq 0x2d9d3(%rip), %rsi     # 0x2f9d0
movq %rsp, %r14
movl $0x90, %edx
movq %r14, %rdi
callq 0x1100
leaq 0x98(%rsp), %r15
movl $0x898, %edx            # imm = 0x898
movq %r15, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0x90, %edx
movq %r15, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x13177
movq 0x8(%r15), %r12
movq %r15, %rdi
movl $0x420094, %esi         # imm = 0x420094
callq 0x136fa
cmpq $0x3, %rax
jne 0x2081
cmpq 0xa0(%rsp), %r12
jne 0x20b8
leaq 0x98(%rsp), %rdi
callq 0x13455
leaq 0x2b1ac(%rip), %rdi     # 0x2d217
leaq 0x2b397(%rip), %rsi     # 0x2d409
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x1090
incw 0x4(%rbx)
jmp 0x20ef
movq %rax, %r14
leaq 0x2b145(%rip), %rdi     # 0x2d1d0
leaq 0x2b377(%rip), %rsi     # 0x2d409
xorl %eax, %eax
callq 0x1090
leaq 0x2b21c(%rip), %rdi     # 0x2d2bc
movq %r14, %rsi
xorl %eax, %eax
callq 0x1090
incw 0x2(%rbx)
cmpq 0xa0(%rsp), %r12
je 0x20dd
leaq 0x2b111(%rip), %rdi     # 0x2d1d0
leaq 0x2b343(%rip), %rsi     # 0x2d409
xorl %eax, %eax
callq 0x1090
leaq 0x2d5af(%rip), %rdi     # 0x2f683
callq 0x1070
incw 0x2(%rbx)
leaq 0x98(%rsp), %rdi
callq 0x13455
movl $0x1, %ebp
movl %ebp, %eax
addq $0x930, %rsp            # imm = 0x930
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq