// File: /workspace/github_c_makefile_star2_O3/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 0x3364(%rip), %rsi      # 0x5060
movq 0x3365(%rip), %rdx      # 0x5068
movl $0x1, %edi
callq *0x3342(%rip)           # 0x5050
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq *0x8(%rax)
testb %al, %al
je 0x2056
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x2075
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2094
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x20b3
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x20d2
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rbx)
testb %al, %al
je 0x20f1
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x2110
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x212f
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x214e
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rbx)
testb %al, %al
je 0x216d
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rbx)
testb %al, %al
je 0x218c
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x21ab
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x21ca
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x21e9
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2208
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2227
movq %rbx, %rdi
callq *0x18(%rbx)
movq 0x3236(%rip), %rsi      # 0x5060
movq 0x3237(%rip), %rdx      # 0x5068
movl $0x2, %edi
callq *0x3214(%rip)           # 0x5050
movq %rax, %rbx
leaq 0x4(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
callq *0x8(%rax)
testb %al, %al
je 0x2246
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x2265
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2284
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x22a3
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x22c2
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x22e1
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x2300
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x231f
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r15
jne 0x233e
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x235d
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rbx)
testb %al, %al
je 0x237c
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x239b
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x23ba
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x23d9
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r15
jne 0x23f8
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2417
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2436
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2455
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2474
leaq 0x4(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x2493
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x24b2
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r15
jne 0x24d1
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x24f0
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x250f
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x252e
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r15
jne 0x254d
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x256c
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x258b
movq %rbx, %rdi
callq *0x18(%rbx)
movq 0x2fa5(%rip), %rax      # 0x4fd8
movq (%rax), %rcx
leaq 0x1465(%rip), %rdi      # 0x34a2
movl $0x9, %esi
movl $0x1, %edx
callq 0x1070
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x136c(%rip), %rdi      # 0x33c9
leaq 0x12f5(%rip), %rsi      # 0x3359
leaq 0x13c0(%rip), %rcx      # 0x342b
movl $0x7a, %edx
callq 0x1040
leaq 0x13bf(%rip), %rdi      # 0x343b
leaq 0x12d6(%rip), %rsi      # 0x3359
leaq 0x13a1(%rip), %rcx      # 0x342b
movl $0x7b, %edx
callq 0x1040
leaq 0x13ba(%rip), %rdi      # 0x3455
leaq 0x12b7(%rip), %rsi      # 0x3359
leaq 0x1382(%rip), %rcx      # 0x342b
movl $0x7c, %edx
callq 0x1040
leaq 0x139b(%rip), %rdi      # 0x3455
leaq 0x1298(%rip), %rsi      # 0x3359
leaq 0x1363(%rip), %rcx      # 0x342b
movl $0x7d, %edx
callq 0x1040
leaq 0x137c(%rip), %rdi      # 0x3455
leaq 0x1279(%rip), %rsi      # 0x3359
leaq 0x1344(%rip), %rcx      # 0x342b
movl $0x7e, %edx
callq 0x1040
leaq 0x12d1(%rip), %rdi      # 0x33c9
leaq 0x125a(%rip), %rsi      # 0x3359
leaq 0x1325(%rip), %rcx      # 0x342b
movl $0x80, %edx
callq 0x1040
leaq 0x12da(%rip), %rdi      # 0x33f1
leaq 0x123b(%rip), %rsi      # 0x3359
leaq 0x1306(%rip), %rcx      # 0x342b
movl $0x81, %edx
callq 0x1040
leaq 0x1338(%rip), %rdi      # 0x346e
leaq 0x121c(%rip), %rsi      # 0x3359
leaq 0x12e7(%rip), %rcx      # 0x342b
movl $0x82, %edx
callq 0x1040
leaq 0x1300(%rip), %rdi      # 0x3455
leaq 0x11fd(%rip), %rsi      # 0x3359
leaq 0x12c8(%rip), %rcx      # 0x342b
movl $0x83, %edx
callq 0x1040
leaq 0x1255(%rip), %rdi      # 0x33c9
leaq 0x11de(%rip), %rsi      # 0x3359
leaq 0x12a9(%rip), %rcx      # 0x342b
movl $0x85, %edx
callq 0x1040
leaq 0x125e(%rip), %rdi      # 0x33f1
leaq 0x11bf(%rip), %rsi      # 0x3359
leaq 0x128a(%rip), %rcx      # 0x342b
movl $0x86, %edx
callq 0x1040
leaq 0x1257(%rip), %rdi      # 0x3409
leaq 0x11a0(%rip), %rsi      # 0x3359
leaq 0x126b(%rip), %rcx      # 0x342b
movl $0x87, %edx
callq 0x1040
leaq 0x12b7(%rip), %rdi      # 0x3488
leaq 0x1181(%rip), %rsi      # 0x3359
leaq 0x124c(%rip), %rcx      # 0x342b
movl $0x88, %edx
callq 0x1040
leaq 0x1265(%rip), %rdi      # 0x3455
leaq 0x1162(%rip), %rsi      # 0x3359
leaq 0x122d(%rip), %rcx      # 0x342b
movl $0x89, %edx
callq 0x1040
leaq 0x1246(%rip), %rdi      # 0x3455
leaq 0x1143(%rip), %rsi      # 0x3359
leaq 0x120e(%rip), %rcx      # 0x342b
movl $0x8a, %edx
callq 0x1040
leaq 0x1227(%rip), %rdi      # 0x3455
leaq 0x1124(%rip), %rsi      # 0x3359
leaq 0x11ef(%rip), %rcx      # 0x342b
movl $0x8b, %edx
callq 0x1040
leaq 0x117c(%rip), %rdi      # 0x33c9
leaq 0x1105(%rip), %rsi      # 0x3359
leaq 0x11d0(%rip), %rcx      # 0x342b
movl $0x92, %edx
callq 0x1040
leaq 0x11cf(%rip), %rdi      # 0x343b
leaq 0x10e6(%rip), %rsi      # 0x3359
leaq 0x11b1(%rip), %rcx      # 0x342b
movl $0x93, %edx
callq 0x1040
leaq 0x11ca(%rip), %rdi      # 0x3455
leaq 0x10c7(%rip), %rsi      # 0x3359
leaq 0x1192(%rip), %rcx      # 0x342b
movl $0x94, %edx
callq 0x1040
leaq 0x11ab(%rip), %rdi      # 0x3455
leaq 0x10a8(%rip), %rsi      # 0x3359
leaq 0x1173(%rip), %rcx      # 0x342b
movl $0x95, %edx
callq 0x1040
leaq 0x118c(%rip), %rdi      # 0x3455
leaq 0x1089(%rip), %rsi      # 0x3359
leaq 0x1154(%rip), %rcx      # 0x342b
movl $0x96, %edx
callq 0x1040
leaq 0x10e1(%rip), %rdi      # 0x33c9
leaq 0x106a(%rip), %rsi      # 0x3359
leaq 0x1135(%rip), %rcx      # 0x342b
movl $0x98, %edx
callq 0x1040
leaq 0x10ea(%rip), %rdi      # 0x33f1
leaq 0x104b(%rip), %rsi      # 0x3359
leaq 0x1116(%rip), %rcx      # 0x342b
movl $0x99, %edx
callq 0x1040
leaq 0x1115(%rip), %rdi      # 0x343b
leaq 0x102c(%rip), %rsi      # 0x3359
leaq 0x10f7(%rip), %rcx      # 0x342b
movl $0x9a, %edx
callq 0x1040
leaq 0x1129(%rip), %rdi      # 0x346e
leaq 0x100d(%rip), %rsi      # 0x3359
leaq 0x10d8(%rip), %rcx      # 0x342b
movl $0x9b, %edx
callq 0x1040
leaq 0x10f1(%rip), %rdi      # 0x3455
leaq 0xfee(%rip), %rsi       # 0x3359
leaq 0x10b9(%rip), %rcx      # 0x342b
movl $0x9c, %edx
callq 0x1040
leaq 0x1046(%rip), %rdi      # 0x33c9
leaq 0xfcf(%rip), %rsi       # 0x3359
leaq 0x109a(%rip), %rcx      # 0x342b
movl $0x9e, %edx
callq 0x1040
leaq 0x104f(%rip), %rdi      # 0x33f1
leaq 0xfb0(%rip), %rsi       # 0x3359
leaq 0x107b(%rip), %rcx      # 0x342b
movl $0x9f, %edx
callq 0x1040
leaq 0x1048(%rip), %rdi      # 0x3409
leaq 0xf91(%rip), %rsi       # 0x3359
leaq 0x105c(%rip), %rcx      # 0x342b
movl $0xa0, %edx
callq 0x1040
leaq 0x108e(%rip), %rdi      # 0x346e
leaq 0xf72(%rip), %rsi       # 0x3359
leaq 0x103d(%rip), %rcx      # 0x342b
movl $0xa1, %edx
callq 0x1040
leaq 0x1089(%rip), %rdi      # 0x3488
leaq 0xf53(%rip), %rsi       # 0x3359
leaq 0x101e(%rip), %rcx      # 0x342b
movl $0xa2, %edx
callq 0x1040
leaq 0x1037(%rip), %rdi      # 0x3455
leaq 0xf34(%rip), %rsi       # 0x3359
leaq 0xfff(%rip), %rcx       # 0x342b
movl $0xa3, %edx
callq 0x1040
leaq 0x1018(%rip), %rdi      # 0x3455
leaq 0xf15(%rip), %rsi       # 0x3359
leaq 0xfe0(%rip), %rcx       # 0x342b
movl $0xa4, %edx
callq 0x1040
leaq 0xff9(%rip), %rdi       # 0x3455
leaq 0xef6(%rip), %rsi       # 0x3359
leaq 0xfc1(%rip), %rcx       # 0x342b
movl $0xa5, %edx
callq 0x1040
leaq 0xfda(%rip), %rdi       # 0x3455
leaq 0xed7(%rip), %rsi       # 0x3359
leaq 0xfa2(%rip), %rcx       # 0x342b
movl $0xa6, %edx
callq 0x1040
leaq 0xf2f(%rip), %rdi       # 0x33c9
leaq 0xeb8(%rip), %rsi       # 0x3359
leaq 0xf83(%rip), %rcx       # 0x342b
movl $0xa8, %edx
callq 0x1040
leaq 0xf38(%rip), %rdi       # 0x33f1
leaq 0xe99(%rip), %rsi       # 0x3359
leaq 0xf64(%rip), %rcx       # 0x342b
movl $0xa9, %edx
callq 0x1040
leaq 0xf63(%rip), %rdi       # 0x343b
leaq 0xe7a(%rip), %rsi       # 0x3359
leaq 0xf45(%rip), %rcx       # 0x342b
movl $0xaa, %edx
callq 0x1040
leaq 0xf12(%rip), %rdi       # 0x3409
leaq 0xe5b(%rip), %rsi       # 0x3359
leaq 0xf26(%rip), %rcx       # 0x342b
movl $0xab, %edx
callq 0x1040
leaq 0xf58(%rip), %rdi       # 0x346e
leaq 0xe3c(%rip), %rsi       # 0x3359
leaq 0xf07(%rip), %rcx       # 0x342b
movl $0xac, %edx
callq 0x1040
leaq 0xe94(%rip), %rdi       # 0x33c9
leaq 0xe1d(%rip), %rsi       # 0x3359
leaq 0xee8(%rip), %rcx       # 0x342b
movl $0xad, %edx
callq 0x1040
leaq 0xf34(%rip), %rdi       # 0x3488
leaq 0xdfe(%rip), %rsi       # 0x3359
leaq 0xec9(%rip), %rcx       # 0x342b
movl $0xae, %edx
callq 0x1040
leaq 0xec8(%rip), %rdi       # 0x343b
leaq 0xddf(%rip), %rsi       # 0x3359
leaq 0xeaa(%rip), %rcx       # 0x342b
movl $0xaf, %edx
callq 0x1040
leaq 0xec3(%rip), %rdi       # 0x3455
leaq 0xdc0(%rip), %rsi       # 0x3359
leaq 0xe8b(%rip), %rcx       # 0x342b
movl $0xb0, %edx
callq 0x1040
nop