// File: /workspace/github_c_makefile_star2_O0/cgaebel[P]pipe/pipe.c
// Function: _pipe_pop
static inline size_t __pipe_pop(pipe_t* p,
                                void* restrict target,
                                size_t requested)
{
    if(unlikely(requested == 0))
        return 0;

    size_t popped = 0;

    { mutex_lock(&p->begin_lock);
        snapshot_t s      = wait_for_elements(p);
        size_t bytes_used = bytes_in_use(s);

        if(unlikely(bytes_used == 0))
        {
            mutex_unlock(&p->begin_lock);
            return 0;
        }

        check_invariants(p);

        s = pop_without_locking(s, target,
                                popped = min(requested, bytes_used),
                                &p->begin
        );

        check_invariants(p);

        trim_buffer(p, s);
    } // p->begin_lock was unlocked by trim_buffer.

    assertume(popped);

    if(unlikely(popped == __pipe_elem_size(p)))
        cond_signal(&p->just_popped);
    else
        cond_broadcast(&p->just_popped);

    return popped;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x2669
movq $0x0, -0x8(%rbp)
jmp 0x2811
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
callq 0x1160
movq -0x10(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x2cf0
movq -0x30(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups -0x50(%rbp), %xmm0
movups -0x40(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x24b0
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x26dd
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
callq 0x10e0
movq $0x0, -0x8(%rbp)
jmp 0x2811
movq -0x10(%rbp), %rdi
callq 0x1610
movq -0x18(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x58(%rbp), %rax
ja 0x2708
movq -0x20(%rbp), %rax
movq %rax, -0x90(%rbp)
jmp 0x2713
movq -0x58(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq %rdx, -0x28(%rbp)
movq -0x10(%rbp), %rcx
addq $0x28, %rcx
movq -0x30(%rbp), %rdi
movq %rsp, %rax
movq %rdi, 0x20(%rax)
movups -0x50(%rbp), %xmm0
movups -0x40(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x80(%rbp), %rdi
callq 0x2df0
leaq -0x50(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movl $0x28, %edx
callq 0x10c0
movq -0x10(%rbp), %rdi
callq 0x1610
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups -0x50(%rbp), %xmm0
movups -0x40(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x2fc0
cmpq $0x0, -0x28(%rbp)
je 0x2797
jmp 0x27b6
leaq 0x2c0c(%rip), %rdi      # 0x53aa
leaq 0x28ba(%rip), %rsi      # 0x505f
movl $0x433, %edx            # imm = 0x433
leaq 0x2c00(%rip), %rcx      # 0x53b1
callq 0x1080
movq -0x28(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1290
movq %rax, %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x27f9
movq -0x10(%rbp), %rdi
addq $0xc8, %rdi
callq 0x10b0
jmp 0x2809
movq -0x10(%rbp), %rdi
addq $0xc8, %rdi
callq 0x1040
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nop