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

    uint8 encoding[80] = {
        0x42, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x30, 
        0x42, 0x00, 0x0A, 0x07, 0x00, 0x00, 0x00, 0x18, 
        0x43, 0x72, 0x79, 0x70, 0x74, 0x6F, 0x67, 0x72, 
        0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x55, 0x73, 
        0x61, 0x67, 0x65, 0x20, 0x4D, 0x61, 0x73, 0x6B, 
        0x42, 0x00, 0x0B, 0x02, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x30, 
        0x42, 0x00, 0x0A, 0x07, 0x00, 0x00, 0x00, 0x18, 
        0x43, 0x72, 0x79, 0x70, 0x74, 0x6F, 0x67, 0x72 
    };

    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_ATTRIBUTE);
    if(count != 1)
    {
        printf("FAIL - %s\n", __func__);
        printf("- expected item count not found (exp. 1, 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 $0x920, %rsp            # imm = 0x920
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0x60(%rbp), %rdi
leaq 0x3f318(%rip), %rsi     # 0x417c0
movl $0x50, %edx
callq 0x10c0
leaq -0x8f8(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x60(%rbp), %rsi
leaq -0x8f8(%rbp), %rdi
movl $0x50, %edx
xorl %ecx, %ecx
callq 0x1c6e0
movq -0x8f0(%rbp), %rax
movq %rax, -0x900(%rbp)
movl $0x0, -0x904(%rbp)
movq $0x0, -0x910(%rbp)
leaq -0x8f8(%rbp), %rdi
movl $0x420008, %esi         # imm = 0x420008
callq 0x1cf70
movq %rax, -0x910(%rbp)
cmpq $0x1, -0x910(%rbp)
je 0x2565
leaq 0x3cadc(%rip), %rdi     # 0x3f004
leaq 0x3cd49(%rip), %rsi     # 0x3f278
movb $0x0, %al
callq 0x1070
movq -0x910(%rbp), %rsi
leaq 0x3cd5f(%rip), %rdi     # 0x3f2a3
movb $0x0, %al
callq 0x1070
movq -0x8(%rbp), %rax
movw 0x2(%rax), %cx
addw $0x1, %cx
movw %cx, 0x2(%rax)
movl $0x1, -0x904(%rbp)
movq -0x8f0(%rbp), %rax
movq %rax, -0x918(%rbp)
movq -0x900(%rbp), %rax
cmpq -0x918(%rbp), %rax
je 0x25c0
leaq 0x3ca7a(%rip), %rdi     # 0x3f004
leaq 0x3cce7(%rip), %rsi     # 0x3f278
movb $0x0, %al
callq 0x1070
leaq 0x3cc46(%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, -0x904(%rbp)
leaq -0x8f8(%rbp), %rdi
callq 0x1cab0
cmpl $0x0, -0x904(%rbp)
jne 0x25fa
leaq 0x3ca6f(%rip), %rdi     # 0x3f04b
leaq 0x3cc95(%rip), %rsi     # 0x3f278
movb $0x0, %al
callq 0x1070
movq -0x8(%rbp), %rax
movw 0x4(%rax), %cx
addw $0x1, %cx
movw %cx, 0x4(%rax)
movl -0x904(%rbp), %eax
addq $0x920, %rsp            # imm = 0x920
popq %rbp
retq
nopl (%rax)