// File: /workspace/github_c_makefile_star2_O2/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 0x34a5(%rip), %rsi      # 0x5060
movq 0x34a6(%rip), %rdx      # 0x5068
pushq $0x1
popq %rdi
callq *0x3485(%rip)           # 0x5050
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq *0x8(%rax)
testb %al, %al
je 0x1f0d
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x1f26
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x1f3f
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x1f58
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x1f71
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rbx)
testb %al, %al
je 0x1f8e
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x1fad
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x1fcc
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x1feb
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rbx)
testb %al, %al
je 0x200a
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rbx)
testb %al, %al
je 0x2029
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x2048
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x2067
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2086
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x20a5
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x20c4
movq %rbx, %rdi
callq *0x18(%rbx)
movq 0x3379(%rip), %rsi      # 0x5060
movq 0x337a(%rip), %rdx      # 0x5068
pushq $0x2
popq %rdi
callq *0x3359(%rip)           # 0x5050
movq %rax, %rbx
leaq 0x4(%rsp), %r14
movq %rax, %rdi
movq %r14, %rsi
callq *0x8(%rax)
testb %al, %al
je 0x20e3
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x2102
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2121
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2140
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x215f
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x217e
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x219d
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x21bc
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r15
jne 0x21db
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x21fa
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq *0x8(%rbx)
testb %al, %al
je 0x2219
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x2238
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x2257
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x2276
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r15
jne 0x2295
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x22b4
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x22d3
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x22f2
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2311
leaq 0x4(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
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
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r15
jne 0x236e
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x238d
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x23ac
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rbx)
testb %al, %al
je 0x23cb
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r15
jne 0x23ea
movq %rbx, %rdi
callq *0x10(%rbx)
cmpq %rax, %r14
jne 0x2409
movq %rbx, %rdi
callq *0x10(%rbx)
testq %rax, %rax
jne 0x2428
movq %rbx, %rdi
callq *0x18(%rbx)
movq 0x30ea(%rip), %rax      # 0x4fd8
movq (%rax), %rcx
leaq 0x155e(%rip), %rdi      # 0x3456
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
callq 0x1070
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1469(%rip), %rdi      # 0x337d
leaq 0x13f2(%rip), %rsi      # 0x330d
leaq 0x14bd(%rip), %rcx      # 0x33df
pushq $0x7a
jmp 0x1f88
leaq 0x14c2(%rip), %rdi      # 0x33ef
leaq 0x13d9(%rip), %rsi      # 0x330d
leaq 0x14a4(%rip), %rcx      # 0x33df
pushq $0x7b
jmp 0x1f88
leaq 0x14c3(%rip), %rdi      # 0x3409
leaq 0x13c0(%rip), %rsi      # 0x330d
leaq 0x148b(%rip), %rcx      # 0x33df
pushq $0x7c
jmp 0x1f88
leaq 0x14aa(%rip), %rdi      # 0x3409
leaq 0x13a7(%rip), %rsi      # 0x330d
leaq 0x1472(%rip), %rcx      # 0x33df
pushq $0x7d
jmp 0x1f88
leaq 0x1491(%rip), %rdi      # 0x3409
leaq 0x138e(%rip), %rsi      # 0x330d
leaq 0x1459(%rip), %rcx      # 0x33df
pushq $0x7e
popq %rdx
callq 0x1040
leaq 0x13e8(%rip), %rdi      # 0x337d
leaq 0x1371(%rip), %rsi      # 0x330d
leaq 0x143c(%rip), %rcx      # 0x33df
movl $0x80, %edx
callq 0x1040
leaq 0x13f1(%rip), %rdi      # 0x33a5
leaq 0x1352(%rip), %rsi      # 0x330d
leaq 0x141d(%rip), %rcx      # 0x33df
movl $0x81, %edx
callq 0x1040
leaq 0x144f(%rip), %rdi      # 0x3422
leaq 0x1333(%rip), %rsi      # 0x330d
leaq 0x13fe(%rip), %rcx      # 0x33df
movl $0x82, %edx
callq 0x1040
leaq 0x1417(%rip), %rdi      # 0x3409
leaq 0x1314(%rip), %rsi      # 0x330d
leaq 0x13df(%rip), %rcx      # 0x33df
movl $0x83, %edx
callq 0x1040
leaq 0x136c(%rip), %rdi      # 0x337d
leaq 0x12f5(%rip), %rsi      # 0x330d
leaq 0x13c0(%rip), %rcx      # 0x33df
movl $0x85, %edx
callq 0x1040
leaq 0x1375(%rip), %rdi      # 0x33a5
leaq 0x12d6(%rip), %rsi      # 0x330d
leaq 0x13a1(%rip), %rcx      # 0x33df
movl $0x86, %edx
callq 0x1040
leaq 0x136e(%rip), %rdi      # 0x33bd
leaq 0x12b7(%rip), %rsi      # 0x330d
leaq 0x1382(%rip), %rcx      # 0x33df
movl $0x87, %edx
callq 0x1040
leaq 0x13ce(%rip), %rdi      # 0x343c
leaq 0x1298(%rip), %rsi      # 0x330d
leaq 0x1363(%rip), %rcx      # 0x33df
movl $0x88, %edx
callq 0x1040
leaq 0x137c(%rip), %rdi      # 0x3409
leaq 0x1279(%rip), %rsi      # 0x330d
leaq 0x1344(%rip), %rcx      # 0x33df
movl $0x89, %edx
callq 0x1040
leaq 0x135d(%rip), %rdi      # 0x3409
leaq 0x125a(%rip), %rsi      # 0x330d
leaq 0x1325(%rip), %rcx      # 0x33df
movl $0x8a, %edx
callq 0x1040
leaq 0x133e(%rip), %rdi      # 0x3409
leaq 0x123b(%rip), %rsi      # 0x330d
leaq 0x1306(%rip), %rcx      # 0x33df
movl $0x8b, %edx
callq 0x1040
leaq 0x1293(%rip), %rdi      # 0x337d
leaq 0x121c(%rip), %rsi      # 0x330d
leaq 0x12e7(%rip), %rcx      # 0x33df
movl $0x92, %edx
callq 0x1040
leaq 0x12e6(%rip), %rdi      # 0x33ef
leaq 0x11fd(%rip), %rsi      # 0x330d
leaq 0x12c8(%rip), %rcx      # 0x33df
movl $0x93, %edx
callq 0x1040
leaq 0x12e1(%rip), %rdi      # 0x3409
leaq 0x11de(%rip), %rsi      # 0x330d
leaq 0x12a9(%rip), %rcx      # 0x33df
movl $0x94, %edx
callq 0x1040
leaq 0x12c2(%rip), %rdi      # 0x3409
leaq 0x11bf(%rip), %rsi      # 0x330d
leaq 0x128a(%rip), %rcx      # 0x33df
movl $0x95, %edx
callq 0x1040
leaq 0x12a3(%rip), %rdi      # 0x3409
leaq 0x11a0(%rip), %rsi      # 0x330d
leaq 0x126b(%rip), %rcx      # 0x33df
movl $0x96, %edx
callq 0x1040
leaq 0x11f8(%rip), %rdi      # 0x337d
leaq 0x1181(%rip), %rsi      # 0x330d
leaq 0x124c(%rip), %rcx      # 0x33df
movl $0x98, %edx
callq 0x1040
leaq 0x1201(%rip), %rdi      # 0x33a5
leaq 0x1162(%rip), %rsi      # 0x330d
leaq 0x122d(%rip), %rcx      # 0x33df
movl $0x99, %edx
callq 0x1040
leaq 0x122c(%rip), %rdi      # 0x33ef
leaq 0x1143(%rip), %rsi      # 0x330d
leaq 0x120e(%rip), %rcx      # 0x33df
movl $0x9a, %edx
callq 0x1040
leaq 0x1240(%rip), %rdi      # 0x3422
leaq 0x1124(%rip), %rsi      # 0x330d
leaq 0x11ef(%rip), %rcx      # 0x33df
movl $0x9b, %edx
callq 0x1040
leaq 0x1208(%rip), %rdi      # 0x3409
leaq 0x1105(%rip), %rsi      # 0x330d
leaq 0x11d0(%rip), %rcx      # 0x33df
movl $0x9c, %edx
callq 0x1040
leaq 0x115d(%rip), %rdi      # 0x337d
leaq 0x10e6(%rip), %rsi      # 0x330d
leaq 0x11b1(%rip), %rcx      # 0x33df
movl $0x9e, %edx
callq 0x1040
leaq 0x1166(%rip), %rdi      # 0x33a5
leaq 0x10c7(%rip), %rsi      # 0x330d
leaq 0x1192(%rip), %rcx      # 0x33df
movl $0x9f, %edx
callq 0x1040
leaq 0x115f(%rip), %rdi      # 0x33bd
leaq 0x10a8(%rip), %rsi      # 0x330d
leaq 0x1173(%rip), %rcx      # 0x33df
movl $0xa0, %edx
callq 0x1040
leaq 0x11a5(%rip), %rdi      # 0x3422
leaq 0x1089(%rip), %rsi      # 0x330d
leaq 0x1154(%rip), %rcx      # 0x33df
movl $0xa1, %edx
callq 0x1040
leaq 0x11a0(%rip), %rdi      # 0x343c
leaq 0x106a(%rip), %rsi      # 0x330d
leaq 0x1135(%rip), %rcx      # 0x33df
movl $0xa2, %edx
callq 0x1040
leaq 0x114e(%rip), %rdi      # 0x3409
leaq 0x104b(%rip), %rsi      # 0x330d
leaq 0x1116(%rip), %rcx      # 0x33df
movl $0xa3, %edx
callq 0x1040
leaq 0x112f(%rip), %rdi      # 0x3409
leaq 0x102c(%rip), %rsi      # 0x330d
leaq 0x10f7(%rip), %rcx      # 0x33df
movl $0xa4, %edx
callq 0x1040
leaq 0x1110(%rip), %rdi      # 0x3409
leaq 0x100d(%rip), %rsi      # 0x330d
leaq 0x10d8(%rip), %rcx      # 0x33df
movl $0xa5, %edx
callq 0x1040
leaq 0x10f1(%rip), %rdi      # 0x3409
leaq 0xfee(%rip), %rsi       # 0x330d
leaq 0x10b9(%rip), %rcx      # 0x33df
movl $0xa6, %edx
callq 0x1040
leaq 0x1046(%rip), %rdi      # 0x337d
leaq 0xfcf(%rip), %rsi       # 0x330d
leaq 0x109a(%rip), %rcx      # 0x33df
movl $0xa8, %edx
callq 0x1040
leaq 0x104f(%rip), %rdi      # 0x33a5
leaq 0xfb0(%rip), %rsi       # 0x330d
leaq 0x107b(%rip), %rcx      # 0x33df
movl $0xa9, %edx
callq 0x1040
leaq 0x107a(%rip), %rdi      # 0x33ef
leaq 0xf91(%rip), %rsi       # 0x330d
leaq 0x105c(%rip), %rcx      # 0x33df
movl $0xaa, %edx
callq 0x1040
leaq 0x1029(%rip), %rdi      # 0x33bd
leaq 0xf72(%rip), %rsi       # 0x330d
leaq 0x103d(%rip), %rcx      # 0x33df
movl $0xab, %edx
callq 0x1040
leaq 0x106f(%rip), %rdi      # 0x3422
leaq 0xf53(%rip), %rsi       # 0x330d
leaq 0x101e(%rip), %rcx      # 0x33df
movl $0xac, %edx
callq 0x1040
leaq 0xfab(%rip), %rdi       # 0x337d
leaq 0xf34(%rip), %rsi       # 0x330d
leaq 0xfff(%rip), %rcx       # 0x33df
movl $0xad, %edx
callq 0x1040
leaq 0x104b(%rip), %rdi      # 0x343c
leaq 0xf15(%rip), %rsi       # 0x330d
leaq 0xfe0(%rip), %rcx       # 0x33df
movl $0xae, %edx
callq 0x1040
leaq 0xfdf(%rip), %rdi       # 0x33ef
leaq 0xef6(%rip), %rsi       # 0x330d
leaq 0xfc1(%rip), %rcx       # 0x33df
movl $0xaf, %edx
callq 0x1040
leaq 0xfda(%rip), %rdi       # 0x3409
leaq 0xed7(%rip), %rsi       # 0x330d
leaq 0xfa2(%rip), %rcx       # 0x33df
movl $0xb0, %edx
callq 0x1040
nop