// File: /workspace/github_c_makefile_star2_O0/cgaebel[P]pipe/pipe.c
// Function: pop_without_locking
static inline snapshot_t pop_without_locking(snapshot_t s,
                                             void* restrict target,
                                             size_t bytes_to_copy,
                                             char** begin // [out]
                                            )
{
    assertume(s.begin != s.bufend);

    size_t elem_size = s.elem_size;

    // Copy either as many bytes as requested, or the available bytes in the RHS
    // of a wrapped buffer - whichever is smaller.
    {
        size_t first_bytes_to_copy = min(bytes_to_copy, (size_t)(s.bufend - s.begin - elem_size));

        target = offset_memcpy(target, s.begin + elem_size, first_bytes_to_copy);

        bytes_to_copy -= first_bytes_to_copy;

        s.begin       += first_bytes_to_copy;
        s.begin = wrap_ptr_if_necessary(s.buffer, s.begin, s.bufend);
    }

    if(unlikely(bytes_to_copy > 0))
    {
        s.begin += elem_size;
        s.begin = wrap_ptr_if_necessary(s.buffer, s.begin, s.bufend);

        memcpy(target, s.begin, bytes_to_copy);

        s.begin += bytes_to_copy;
        s.begin = wrap_ptr_if_necessary(s.buffer, s.begin, s.bufend);

        s.begin -= elem_size;
        s.begin = rev_wrap_ptr_if_necessary(s.buffer, s.begin, s.bufend);
    }

    // Since we cached begin on the stack, we need to reflect our changes back
    // on the pipe.
    *begin = s.begin;

    return s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rcx, %rax
movq %rdi, -0x40(%rbp)
movq %rdi, -0x38(%rbp)
leaq 0x10(%rbp), %rcx
movq %rcx, -0x30(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rax, -0x18(%rbp)
movq 0x10(%rcx), %rax
cmpq 0x8(%rcx), %rax
je 0x2e23
jmp 0x2e42
leaq 0x25bb(%rip), %rdi      # 0x53e5
leaq 0x222e(%rip), %rsi      # 0x505f
movl $0x3c0, %edx            # imm = 0x3C0
leaq 0x25bc(%rip), %rcx      # 0x53f9
callq 0x1080
movq -0x30(%rbp), %rdx
movq 0x20(%rdx), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rdx), %rcx
movq 0x10(%rdx), %rdx
subq %rdx, %rcx
subq -0x20(%rbp), %rcx
cmpq %rcx, %rax
ja 0x2e70
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x2e87
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rax
movq 0x10(%rcx), %rcx
subq %rcx, %rax
subq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq 0x10(%rax), %rsi
addq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x2c60
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, -0x8(%rbp)
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rcx
subq %rdx, %rcx
movq %rcx, -0x10(%rbp)
movq -0x28(%rbp), %rcx
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq (%rax), %rdi
movq 0x10(%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x2ca0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
cmpq $0x0, -0x10(%rbp)
seta %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x2f98
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq (%rax), %rdi
movq 0x10(%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x2ca0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq 0x10(%rax), %rsi
movq -0x10(%rbp), %rdx
callq 0x10c0
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq (%rax), %rdi
movq 0x10(%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x2ca0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rsi
movq 0x10(%rax), %rcx
xorl %edx, %edx
subq %rsi, %rdx
addq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq (%rax), %rdi
movq 0x10(%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x3130
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rsi
movq -0x40(%rbp), %rdi
movq 0x10(%rsi), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x28, %edx
callq 0x10c0
movq -0x38(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nop