	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_evbuffer_drain                 ## -- Begin function evbuffer_drain
	.p2align	4, 0x90
_evbuffer_drain:                        ## @evbuffer_drain
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r14
	callq	_EVBUFFER_LOCK
	movq	(%r14), %r12
	xorl	%ebx, %ebx
	testq	%r12, %r12
	je	LBB0_19
## %bb.1:
	movl	$-1, %ebx
	cmpq	$0, 32(%r14)
	jne	LBB0_19
## %bb.2:
	movq	%r12, %rax
	cmpq	%r15, %r12
	ja	LBB0_5
## %bb.3:
	movq	%r14, %rdi
	callq	_HAS_PINNED_R
	testl	%eax, %eax
	je	LBB0_7
## %bb.4:
	movq	(%r14), %rax
LBB0_5:
	cmpq	%r15, %r12
	cmovaeq	%r15, %r12
	subq	%r12, %rax
	movq	%rax, (%r14)
	leaq	16(%r14), %r13
	movq	16(%r14), %rbx
	movq	(%rbx), %rax
	cmpq	%rax, %r12
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	movq	%r12, %r15
	jae	LBB0_10
## %bb.6:
	movq	%rbx, %r12
	jmp	LBB0_16
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	leaq	16(%rbx), %rdx
	movq	16(%rbx), %r12
	movq	24(%r14), %rcx
	cmpq	(%rcx), %rbx
	cmoveq	%r13, %rcx
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	cmpq	%rcx, %rdx
	jne	LBB0_13
LBB0_12:                                ##   in Loop: Header=BB0_10 Depth=1
	cmpq	%rcx, %rdx
	cmoveq	%r13, %rcx
	movq	%rcx, 24(%r14)
LBB0_13:                                ##   in Loop: Header=BB0_10 Depth=1
	subq	%rax, %r15
	movq	%rbx, %rdi
	callq	_CHAIN_PINNED_R
	testq	%rax, %rax
	jne	LBB0_14
## %bb.15:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	%rbx, %rdi
	callq	_evbuffer_chain_free
	movq	(%r12), %rax
	movq	%r12, %rbx
	cmpq	%rax, %r15
	jae	LBB0_10
LBB0_16:
	movq	%r12, %rbx
	jmp	LBB0_17
LBB0_7:
	movq	16(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_9
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	16(%rdi), %rbx
	callq	_evbuffer_chain_free
	movq	%rbx, %rdi
	testq	%rbx, %rbx
	jne	LBB0_8
LBB0_9:
	movq	%r14, %rdi
	callq	_ZERO_CHAIN
	jmp	LBB0_18
LBB0_14:
	xorl	%edi, %edi
	testq	%r15, %r15
	sete	%dil
	callq	_EVUTIL_ASSERT
	movq	(%rbx), %rax
	addq	%rax, 8(%rbx)
	movq	$0, (%rbx)
	xorl	%eax, %eax
	movq	%rbx, %r12
LBB0_17:
	movq	%rbx, (%r13)
	xorl	%edi, %edi
	cmpq	%rax, %r15
	setbe	%dil
	callq	_EVUTIL_ASSERT
	addq	%r15, 8(%rbx)
	subq	%r15, (%r12)
	movq	-48(%rbp), %r12                 ## 8-byte Reload
LBB0_18:
	addq	%r12, 8(%r14)
	movq	%r14, %rdi
	callq	_evbuffer_invoke_callbacks_
	xorl	%ebx, %ebx
LBB0_19:
	movq	%r14, %rdi
	callq	_EVBUFFER_UNLOCK
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_evbuffer_drain                 ; -- Begin function evbuffer_drain
	.p2align	2
_evbuffer_drain:                        ; @evbuffer_drain
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x20, x1
	mov	x19, x0
	bl	_EVBUFFER_LOCK
	ldr	x21, [x19]
	cbz	x21, LBB0_21
; %bb.1:
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_3
; %bb.2:
	mov	w20, #-1
	b	LBB0_22
LBB0_3:
	cmp	x21, x20
	b.ls	LBB0_5
; %bb.4:
	mov	x8, x21
	b	LBB0_7
LBB0_5:
	mov	x0, x19
	bl	_HAS_PINNED_R
	cbz	w0, LBB0_15
; %bb.6:
	ldr	x8, [x19]
LBB0_7:
	cmp	x21, x20
	csel	x21, x21, x20, lo
	sub	x8, x8, x21
	str	x8, [x19]
	mov	x22, x19
	ldr	x20, [x22, #16]!
	ldr	x8, [x20]
	cmp	x21, x8
	b.hs	LBB0_9
; %bb.8:
	mov	x24, x20
	mov	x23, x21
	b	LBB0_14
LBB0_9:
	mov	x23, x21
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	mov	x9, x20
	ldr	x24, [x9, #16]!
	sub	x23, x23, x8
	ldr	x8, [x19, #24]
	ldr	x10, [x8]
	cmp	x20, x10
	csel	x8, x22, x8, eq
	ccmp	x9, x8, #4, ne
	b.ne	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	cmp	x9, x8
	csel	x8, x22, x8, eq
	str	x8, [x19, #24]
LBB0_12:                                ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x20
	bl	_CHAIN_PINNED_R
	cbnz	x0, LBB0_18
; %bb.13:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x20
	bl	_evbuffer_chain_free
	ldr	x8, [x24]
	mov	x20, x24
	cmp	x23, x8
	b.hs	LBB0_10
LBB0_14:
	mov	x20, x24
	b	LBB0_19
LBB0_15:
	ldr	x0, [x19, #16]
	cbz	x0, LBB0_17
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	ldr	x20, [x0, #16]
	bl	_evbuffer_chain_free
	mov	x0, x20
	cbnz	x20, LBB0_16
LBB0_17:
	mov	x0, x19
	bl	_ZERO_CHAIN
	b	LBB0_20
LBB0_18:
	cmp	x23, #0
	cset	w0, eq
	bl	_EVUTIL_ASSERT
	mov	x8, #0
	ldp	x9, x10, [x20]
	add	x9, x10, x9
	stp	xzr, x9, [x20]
	mov	x24, x20
LBB0_19:
	str	x20, [x22]
	cmp	x23, x8
	cset	w0, ls
	bl	_EVUTIL_ASSERT
	ldr	x8, [x20, #8]
	add	x8, x8, x23
	str	x8, [x20, #8]
	ldr	x8, [x24]
	sub	x8, x8, x23
	str	x8, [x24]
LBB0_20:
	ldr	x8, [x19, #8]
	add	x8, x8, x21
	str	x8, [x19, #8]
	mov	x0, x19
	bl	_evbuffer_invoke_callbacks_
LBB0_21:
	mov	w20, #0
LBB0_22:
	mov	x0, x19
	bl	_EVBUFFER_UNLOCK
	mov	x0, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
