// File: /workspace/github_c_makefile_star2_O0/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
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 -0xa0(%rbp), %rdi
leaq 0x3f095(%rip), %rsi     # 0x41860
movl $0x90, %edx
callq 0x10c0
leaq -0x938(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0xa0(%rbp), %rsi
leaq -0x938(%rbp), %rdi
movl $0x90, %edx
xorl %ecx, %ecx
callq 0x1c6e0
movq -0x930(%rbp), %rax
movq %rax, -0x940(%rbp)
movl $0x0, -0x944(%rbp)
movq $0x0, -0x950(%rbp)
leaq -0x938(%rbp), %rdi
movl $0x420094, %esi         # imm = 0x420094
callq 0x1cf70
movq %rax, -0x950(%rbp)
cmpq $0x3, -0x950(%rbp)
je 0x288b
leaq 0x3c7b6(%rip), %rdi     # 0x3f004
leaq 0x3cade(%rip), %rsi     # 0x3f333
movb $0x0, %al
callq 0x1070
movq -0x950(%rbp), %rsi
leaq 0x3c947(%rip), %rdi     # 0x3f1b1
movb $0x0, %al
callq 0x1070
movq -0x8(%rbp), %rax
movw 0x2(%rax), %cx
addw $0x1, %cx
movw %cx, 0x2(%rax)
movl $0x1, -0x944(%rbp)
movq -0x930(%rbp), %rax
movq %rax, -0x958(%rbp)
movq -0x940(%rbp), %rax
cmpq -0x958(%rbp), %rax
je 0x28e6
leaq 0x3c754(%rip), %rdi     # 0x3f004
leaq 0x3ca7c(%rip), %rsi     # 0x3f333
movb $0x0, %al
callq 0x1070
leaq 0x3c920(%rip), %rdi     # 0x3f1e5
movb $0x0, %al
callq 0x1070
movq -0x8(%rbp), %rax
movw 0x2(%rax), %cx
addw $0x1, %cx
movw %cx, 0x2(%rax)
movl $0x1, -0x944(%rbp)
leaq -0x938(%rbp), %rdi
callq 0x1cab0
cmpl $0x0, -0x944(%rbp)
jne 0x2920
leaq 0x3c749(%rip), %rdi     # 0x3f04b
leaq 0x3ca2a(%rip), %rsi     # 0x3f333
movb $0x0, %al
callq 0x1070
movq -0x8(%rbp), %rax
movw 0x4(%rax), %cx
addw $0x1, %cx
movw %cx, 0x4(%rax)
movl -0x944(%rbp), %eax
addq $0x960, %rsp            # imm = 0x960
popq %rbp
retq
nop