// File: /workspace/github_c_makefile_star2_O1/vidarr[P]ringbuffer/test/test_helper.c
// Function: test_pop
void test_pop() {

    int a = 1;
    int b = 2;
    int c = 3;

    Ringbuffer* buffer = 0;

    buffer = create(1, free_item, free_item_additional_arg);

    assert(buffer->add(buffer, &a));
    assert(&a == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));

    assert(buffer->add(buffer, &a));
    assert(buffer->add(buffer, &b));
    assert(&b == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));

    assert(buffer->add(buffer, &a));
    assert(buffer->add(buffer, &b));
    assert(buffer->add(buffer, &c));
    assert(&c == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));

    buffer = buffer->free(buffer);


    buffer = create(2, free_item, free_item_additional_arg);

    assert(buffer->add(buffer, &a));
    assert(&a == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));

    assert(buffer->add(buffer, &a));
    assert(buffer->add(buffer, &b));
    assert(&a == buffer->pop(buffer));
    assert(&b == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));

    assert(buffer->add(buffer, &a));
    assert(buffer->add(buffer, &b));
    assert(buffer->add(buffer, &c));
    assert(&b == buffer->pop(buffer));
    assert(&c == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));

    assert(buffer->add(buffer, &a));
    assert(buffer->add(buffer, &b));
    assert(&a == buffer->pop(buffer));
    assert(buffer->add(buffer, &c));
    assert(&b == buffer->pop(buffer));
    assert(buffer->add(buffer, &a));
    assert(&c == buffer->pop(buffer));
    assert(&a == buffer->pop(buffer));
    assert(0 == buffer->pop(buffer));

    buffer = buffer->free(buffer);

    fprintf(stdout, "pop() OK\n");

}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0x4(%rsp), %r14
movl $0x1, (%r14)
movl $0x2, 0x8(%rsp)
movl $0x3, 0xc(%rsp)
movq 0x33b0(%rip), %rsi      # 0x5060
movq 0x33b1(%rip), %rdx      # 0x5068
movl $0x1, %edi
callq *0x338e(%rip)           # 0x5050
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq *0x8(%rax)
testb %al, %al
je 0x200a
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x2029
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2048
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2067
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2086
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rbx)
testb %al, %al
je 0x20a5
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x20c4
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x20e3
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2102
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rbx)
testb %al, %al
je 0x2121
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rbx)
testb %al, %al
je 0x2140
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x215f
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x217e
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x219d
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x21bc
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x21db
movq %rbx, %rdi
callq *0x18(%rbx)
movq 0x3282(%rip), %rsi      # 0x5060
movq 0x3283(%rip), %rdx      # 0x5068
movl $0x2, %edi
callq *0x3260(%rip)           # 0x5050
movq %rax, %rbx
leaq 0x4(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
callq *0x8(%rax)
testb %al, %al
je 0x21fa
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x2219
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2238
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2257
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2276
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x2295
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x22b4
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x22d3
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r15
jne 0x22f2
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2311
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rbx)
testb %al, %al
je 0x2330
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x234f
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x236e
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x238d
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r15
jne 0x23ac
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x23cb
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x23ea
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2409
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2428
leaq 0x4(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x2447
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x2466
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r15
jne 0x2485
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x24a4
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x24c3
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x24e2
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r15
jne 0x2501
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x2520
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x253f
movq %rbx, %rdi
callq *0x18(%rbx)
movq 0x2ff1(%rip), %rax      # 0x4fd8
movq (%rax), %rcx
leaq 0x1465(%rip), %rdi      # 0x3456
movl $0x9, %esi
movl $0x1, %edx
callq 0x1070
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x136c(%rip), %rdi      # 0x337d
leaq 0x12f5(%rip), %rsi      # 0x330d
leaq 0x13c0(%rip), %rcx      # 0x33df
movl $0x7a, %edx
callq 0x1040
leaq 0x13bf(%rip), %rdi      # 0x33ef
leaq 0x12d6(%rip), %rsi      # 0x330d
leaq 0x13a1(%rip), %rcx      # 0x33df
movl $0x7b, %edx
callq 0x1040
leaq 0x13ba(%rip), %rdi      # 0x3409
leaq 0x12b7(%rip), %rsi      # 0x330d
leaq 0x1382(%rip), %rcx      # 0x33df
movl $0x7c, %edx
callq 0x1040
leaq 0x139b(%rip), %rdi      # 0x3409
leaq 0x1298(%rip), %rsi      # 0x330d
leaq 0x1363(%rip), %rcx      # 0x33df
movl $0x7d, %edx
callq 0x1040
leaq 0x137c(%rip), %rdi      # 0x3409
leaq 0x1279(%rip), %rsi      # 0x330d
leaq 0x1344(%rip), %rcx      # 0x33df
movl $0x7e, %edx
callq 0x1040
leaq 0x12d1(%rip), %rdi      # 0x337d
leaq 0x125a(%rip), %rsi      # 0x330d
leaq 0x1325(%rip), %rcx      # 0x33df
movl $0x80, %edx
callq 0x1040
leaq 0x12da(%rip), %rdi      # 0x33a5
leaq 0x123b(%rip), %rsi      # 0x330d
leaq 0x1306(%rip), %rcx      # 0x33df
movl $0x81, %edx
callq 0x1040
leaq 0x1338(%rip), %rdi      # 0x3422
leaq 0x121c(%rip), %rsi      # 0x330d
leaq 0x12e7(%rip), %rcx      # 0x33df
movl $0x82, %edx
callq 0x1040
leaq 0x1300(%rip), %rdi      # 0x3409
leaq 0x11fd(%rip), %rsi      # 0x330d
leaq 0x12c8(%rip), %rcx      # 0x33df
movl $0x83, %edx
callq 0x1040
leaq 0x1255(%rip), %rdi      # 0x337d
leaq 0x11de(%rip), %rsi      # 0x330d
leaq 0x12a9(%rip), %rcx      # 0x33df
movl $0x85, %edx
callq 0x1040
leaq 0x125e(%rip), %rdi      # 0x33a5
leaq 0x11bf(%rip), %rsi      # 0x330d
leaq 0x128a(%rip), %rcx      # 0x33df
movl $0x86, %edx
callq 0x1040
leaq 0x1257(%rip), %rdi      # 0x33bd
leaq 0x11a0(%rip), %rsi      # 0x330d
leaq 0x126b(%rip), %rcx      # 0x33df
movl $0x87, %edx
callq 0x1040
leaq 0x12b7(%rip), %rdi      # 0x343c
leaq 0x1181(%rip), %rsi      # 0x330d
leaq 0x124c(%rip), %rcx      # 0x33df
movl $0x88, %edx
callq 0x1040
leaq 0x1265(%rip), %rdi      # 0x3409
leaq 0x1162(%rip), %rsi      # 0x330d
leaq 0x122d(%rip), %rcx      # 0x33df
movl $0x89, %edx
callq 0x1040
leaq 0x1246(%rip), %rdi      # 0x3409
leaq 0x1143(%rip), %rsi      # 0x330d
leaq 0x120e(%rip), %rcx      # 0x33df
movl $0x8a, %edx
callq 0x1040
leaq 0x1227(%rip), %rdi      # 0x3409
leaq 0x1124(%rip), %rsi      # 0x330d
leaq 0x11ef(%rip), %rcx      # 0x33df
movl $0x8b, %edx
callq 0x1040
leaq 0x117c(%rip), %rdi      # 0x337d
leaq 0x1105(%rip), %rsi      # 0x330d
leaq 0x11d0(%rip), %rcx      # 0x33df
movl $0x92, %edx
callq 0x1040
leaq 0x11cf(%rip), %rdi      # 0x33ef
leaq 0x10e6(%rip), %rsi      # 0x330d
leaq 0x11b1(%rip), %rcx      # 0x33df
movl $0x93, %edx
callq 0x1040
leaq 0x11ca(%rip), %rdi      # 0x3409
leaq 0x10c7(%rip), %rsi      # 0x330d
leaq 0x1192(%rip), %rcx      # 0x33df
movl $0x94, %edx
callq 0x1040
leaq 0x11ab(%rip), %rdi      # 0x3409
leaq 0x10a8(%rip), %rsi      # 0x330d
leaq 0x1173(%rip), %rcx      # 0x33df
movl $0x95, %edx
callq 0x1040
leaq 0x118c(%rip), %rdi      # 0x3409
leaq 0x1089(%rip), %rsi      # 0x330d
leaq 0x1154(%rip), %rcx      # 0x33df
movl $0x96, %edx
callq 0x1040
leaq 0x10e1(%rip), %rdi      # 0x337d
leaq 0x106a(%rip), %rsi      # 0x330d
leaq 0x1135(%rip), %rcx      # 0x33df
movl $0x98, %edx
callq 0x1040
leaq 0x10ea(%rip), %rdi      # 0x33a5
leaq 0x104b(%rip), %rsi      # 0x330d
leaq 0x1116(%rip), %rcx      # 0x33df
movl $0x99, %edx
callq 0x1040
leaq 0x1115(%rip), %rdi      # 0x33ef
leaq 0x102c(%rip), %rsi      # 0x330d
leaq 0x10f7(%rip), %rcx      # 0x33df
movl $0x9a, %edx
callq 0x1040
leaq 0x1129(%rip), %rdi      # 0x3422
leaq 0x100d(%rip), %rsi      # 0x330d
leaq 0x10d8(%rip), %rcx      # 0x33df
movl $0x9b, %edx
callq 0x1040
leaq 0x10f1(%rip), %rdi      # 0x3409
leaq 0xfee(%rip), %rsi       # 0x330d
leaq 0x10b9(%rip), %rcx      # 0x33df
movl $0x9c, %edx
callq 0x1040
leaq 0x1046(%rip), %rdi      # 0x337d
leaq 0xfcf(%rip), %rsi       # 0x330d
leaq 0x109a(%rip), %rcx      # 0x33df
movl $0x9e, %edx
callq 0x1040
leaq 0x104f(%rip), %rdi      # 0x33a5
leaq 0xfb0(%rip), %rsi       # 0x330d
leaq 0x107b(%rip), %rcx      # 0x33df
movl $0x9f, %edx
callq 0x1040
leaq 0x1048(%rip), %rdi      # 0x33bd
leaq 0xf91(%rip), %rsi       # 0x330d
leaq 0x105c(%rip), %rcx      # 0x33df
movl $0xa0, %edx
callq 0x1040
leaq 0x108e(%rip), %rdi      # 0x3422
leaq 0xf72(%rip), %rsi       # 0x330d
leaq 0x103d(%rip), %rcx      # 0x33df
movl $0xa1, %edx
callq 0x1040
leaq 0x1089(%rip), %rdi      # 0x343c
leaq 0xf53(%rip), %rsi       # 0x330d
leaq 0x101e(%rip), %rcx      # 0x33df
movl $0xa2, %edx
callq 0x1040
leaq 0x1037(%rip), %rdi      # 0x3409
leaq 0xf34(%rip), %rsi       # 0x330d
leaq 0xfff(%rip), %rcx       # 0x33df
movl $0xa3, %edx
callq 0x1040
leaq 0x1018(%rip), %rdi      # 0x3409
leaq 0xf15(%rip), %rsi       # 0x330d
leaq 0xfe0(%rip), %rcx       # 0x33df
movl $0xa4, %edx
callq 0x1040
leaq 0xff9(%rip), %rdi       # 0x3409
leaq 0xef6(%rip), %rsi       # 0x330d
leaq 0xfc1(%rip), %rcx       # 0x33df
movl $0xa5, %edx
callq 0x1040
leaq 0xfda(%rip), %rdi       # 0x3409
leaq 0xed7(%rip), %rsi       # 0x330d
leaq 0xfa2(%rip), %rcx       # 0x33df
movl $0xa6, %edx
callq 0x1040
leaq 0xf2f(%rip), %rdi       # 0x337d
leaq 0xeb8(%rip), %rsi       # 0x330d
leaq 0xf83(%rip), %rcx       # 0x33df
movl $0xa8, %edx
callq 0x1040
leaq 0xf38(%rip), %rdi       # 0x33a5
leaq 0xe99(%rip), %rsi       # 0x330d
leaq 0xf64(%rip), %rcx       # 0x33df
movl $0xa9, %edx
callq 0x1040
leaq 0xf63(%rip), %rdi       # 0x33ef
leaq 0xe7a(%rip), %rsi       # 0x330d
leaq 0xf45(%rip), %rcx       # 0x33df
movl $0xaa, %edx
callq 0x1040
leaq 0xf12(%rip), %rdi       # 0x33bd
leaq 0xe5b(%rip), %rsi       # 0x330d
leaq 0xf26(%rip), %rcx       # 0x33df
movl $0xab, %edx
callq 0x1040
leaq 0xf58(%rip), %rdi       # 0x3422
leaq 0xe3c(%rip), %rsi       # 0x330d
leaq 0xf07(%rip), %rcx       # 0x33df
movl $0xac, %edx
callq 0x1040
leaq 0xe94(%rip), %rdi       # 0x337d
leaq 0xe1d(%rip), %rsi       # 0x330d
leaq 0xee8(%rip), %rcx       # 0x33df
movl $0xad, %edx
callq 0x1040
leaq 0xf34(%rip), %rdi       # 0x343c
leaq 0xdfe(%rip), %rsi       # 0x330d
leaq 0xec9(%rip), %rcx       # 0x33df
movl $0xae, %edx
callq 0x1040
leaq 0xec8(%rip), %rdi       # 0x33ef
leaq 0xddf(%rip), %rsi       # 0x330d
leaq 0xeaa(%rip), %rcx       # 0x33df
movl $0xaf, %edx
callq 0x1040
leaq 0xec3(%rip), %rdi       # 0x3409
leaq 0xdc0(%rip), %rsi       # 0x330d
leaq 0xe8b(%rip), %rcx       # 0x33df
movl $0xb0, %edx
callq 0x1040
nop