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

    uint8 a[1] = {0x42};
    uint8 b[3] = {0x42, 0x00, 0x08};
    uint8 c[5] = {0x42, 0x00, 0x53, 0x01, 0x00};

    KMIP ctx = {0};
    kmip_init(&ctx, a, ARRAY_LENGTH(a), KMIP_1_0);

    if(BUFFER_BYTES_LEFT(&ctx) != 1)
    {
        kmip_destroy(&ctx);
        TEST_FAILED(tracker, __func__, __LINE__);
    }

    kmip_destroy(&ctx);
    kmip_init(&ctx, b, ARRAY_LENGTH(b), KMIP_1_0);

    if(BUFFER_BYTES_LEFT(&ctx) != 3)
    {
        kmip_destroy(&ctx);
        TEST_FAILED(tracker, __func__, __LINE__);
    }

    kmip_destroy(&ctx);
    kmip_init(&ctx, c, ARRAY_LENGTH(c), KMIP_1_0);

    if(BUFFER_BYTES_LEFT(&ctx) != 5)
    {
        kmip_destroy(&ctx);
        TEST_FAILED(tracker, __func__, __LINE__);
    }

    kmip_destroy(&ctx);

    TEST_PASSED(tracker, __func__);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x8c0, %rsp            # imm = 0x8C0
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
movb 0x3ef9d(%rip), %al      # 0x418f0
movb %al, -0x11(%rbp)
movw 0x3ef94(%rip), %ax      # 0x418f1
movw %ax, -0x14(%rbp)
movb 0x3ef8c(%rip), %al      # 0x418f3
movb %al, -0x12(%rbp)
movl 0x3ef84(%rip), %eax     # 0x418f4
movl %eax, -0x19(%rbp)
movb 0x3ef7f(%rip), %al      # 0x418f8
movb %al, -0x15(%rbp)
leaq -0x8b8(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x11(%rbp), %rsi
leaq -0x8b8(%rbp), %rdi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x1c6e0
movq -0x8a8(%rbp), %rax
movq -0x8b0(%rbp), %rcx
movq -0x8b8(%rbp), %rdx
subq %rdx, %rcx
subq %rcx, %rax
cmpq $0x1, %rax
je 0x2a09
leaq -0x8b8(%rbp), %rdi
callq 0x1cab0
leaq 0x3c6db(%rip), %rdi     # 0x3f0b5
leaq 0x3c97e(%rip), %rsi     # 0x3f35f
movl $0x2d1, %edx            # imm = 0x2D1
movb $0x0, %al
callq 0x1070
movq -0x10(%rbp), %rax
movw 0x2(%rax), %cx
addw $0x1, %cx
movw %cx, 0x2(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x2b4a
leaq -0x8b8(%rbp), %rdi
callq 0x1cab0
leaq -0x14(%rbp), %rsi
leaq -0x8b8(%rbp), %rdi
movl $0x3, %edx
xorl %ecx, %ecx
callq 0x1c6e0
movq -0x8a8(%rbp), %rax
movq -0x8b0(%rbp), %rcx
movq -0x8b8(%rbp), %rdx
subq %rdx, %rcx
subq %rcx, %rax
cmpq $0x3, %rax
je 0x2a8f
leaq -0x8b8(%rbp), %rdi
callq 0x1cab0
leaq 0x3c655(%rip), %rdi     # 0x3f0b5
leaq 0x3c8f8(%rip), %rsi     # 0x3f35f
movl $0x2da, %edx            # imm = 0x2DA
movb $0x0, %al
callq 0x1070
movq -0x10(%rbp), %rax
movw 0x2(%rax), %cx
addw $0x1, %cx
movw %cx, 0x2(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x2b4a
leaq -0x8b8(%rbp), %rdi
callq 0x1cab0
leaq -0x19(%rbp), %rsi
leaq -0x8b8(%rbp), %rdi
movl $0x5, %edx
xorl %ecx, %ecx
callq 0x1c6e0
movq -0x8a8(%rbp), %rax
movq -0x8b0(%rbp), %rcx
movq -0x8b8(%rbp), %rdx
subq %rdx, %rcx
subq %rcx, %rax
cmpq $0x5, %rax
je 0x2b12
leaq -0x8b8(%rbp), %rdi
callq 0x1cab0
leaq 0x3c5cf(%rip), %rdi     # 0x3f0b5
leaq 0x3c872(%rip), %rsi     # 0x3f35f
movl $0x2e3, %edx            # imm = 0x2E3
movb $0x0, %al
callq 0x1070
movq -0x10(%rbp), %rax
movw 0x2(%rax), %cx
addw $0x1, %cx
movw %cx, 0x2(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x2b4a
leaq -0x8b8(%rbp), %rdi
callq 0x1cab0
leaq 0x3c526(%rip), %rdi     # 0x3f04b
leaq 0x3c833(%rip), %rsi     # 0x3f35f
movb $0x0, %al
callq 0x1070
movq -0x10(%rbp), %rax
movw 0x4(%rax), %cx
addw $0x1, %cx
movw %cx, 0x4(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x8c0, %rsp            # imm = 0x8C0
popq %rbp
retq
nopw %cs:(%rax,%rax)