	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_evbuffer_read                  ## -- Begin function evbuffer_read
	.p2align	4, 0x90
_evbuffer_read:                         ## @evbuffer_read
	.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
	movl	%edx, %r12d
	movl	%esi, %r15d
	movq	%rdi, %r13
	callq	_EVBUFFER_LOCK
	movl	$-1, %r14d
	cmpq	$0, 16(%r13)
	je	LBB0_1
LBB0_6:
	movq	%r13, %rdi
	callq	_EVBUFFER_UNLOCK
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movl	%r15d, %edi
	callq	_get_n_bytes_readable_on_socket
	movq	_EVBUFFER_MAX_READ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpl	%ecx, %eax
	movl	%eax, %edx
	cmovgl	%ecx, %edx
	testl	%eax, %eax
	cmovlel	%ecx, %edx
	cmpl	%r12d, %edx
	movl	%r12d, %ebx
	cmovll	%edx, %ebx
	testl	%r12d, %r12d
	cmovsl	%edx, %ebx
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_evbuffer_expand_singlechain
	testq	%rax, %rax
	je	LBB0_6
## %bb.2:
	movq	%rax, %r12
	movslq	8(%rax), %rax
	addq	(%r12), %rax
	movslq	12(%r12), %rsi
	addq	%rax, %rsi
	movl	%r15d, %edi
	movl	%ebx, %edx
	callq	_read
	movl	%eax, %r14d
	cmpl	$-1, %eax
	je	LBB0_6
## %bb.3:
	testl	%r14d, %r14d
	jne	LBB0_5
## %bb.4:
	xorl	%r14d, %r14d
	jmp	LBB0_6
LBB0_5:
	addl	%r14d, 12(%r12)
	movq	%r13, %rdi
	callq	_advance_last_with_data
	addl	%r14d, (%r13)
	addl	%r14d, 4(%r13)
	movq	%r13, %rdi
	callq	_evbuffer_invoke_callbacks_
	jmp	LBB0_6
	.cfi_endproc
                                        ## -- End function
	.comm	_EVBUFFER_MAX_READ,4,2          ## @EVBUFFER_MAX_READ
	.comm	_EVBUFFER_CHAIN_MAX,8,3         ## @EVBUFFER_CHAIN_MAX
	.comm	_NUM_READ_IOVEC,4,2             ## @NUM_READ_IOVEC
	.comm	_WSAECONNABORTED,8,3            ## @WSAECONNABORTED
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_evbuffer_read                  ; -- Begin function evbuffer_read
	.p2align	2
_evbuffer_read:                         ; @evbuffer_read
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
	bl	_EVBUFFER_LOCK
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_3
LBB0_1:
	mov	w20, #-1
LBB0_2:
	mov	x0, x19
	bl	_EVBUFFER_UNLOCK
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_3:
	mov	x0, x20
	bl	_get_n_bytes_readable_on_socket
Lloh0:
	adrp	x8, _EVBUFFER_MAX_READ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EVBUFFER_MAX_READ@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w0, w8
	ccmp	w0, #1, #8, le
	csel	w8, w8, w0, lt
	cmp	w8, w21
	ccmp	w21, #0, #8, ge
	csel	w22, w8, w21, lt
	mov	x0, x19
	mov	x1, x22
	bl	_evbuffer_expand_singlechain
	cbz	x0, LBB0_1
; %bb.4:
	mov	x21, x0
	ldr	x8, [x0]
	ldpsw	x9, x10, [x0, #8]
	add	x8, x8, x9
	add	x1, x8, x10
	mov	x0, x20
	mov	x2, x22
	bl	_read
	mov	x20, x0
	cmn	w0, #1
	b.eq	LBB0_2
; %bb.5:
	cbz	w20, LBB0_2
; %bb.6:
	ldr	w8, [x21, #12]
	add	w8, w8, w20
	str	w8, [x21, #12]
	mov	x0, x19
	bl	_advance_last_with_data
	ldr	d0, [x19]
	dup.2s	v1, w20
	add.2s	v0, v0, v1
	str	d0, [x19]
	mov	x0, x19
	bl	_evbuffer_invoke_callbacks_
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_EVBUFFER_MAX_READ,4,2          ; @EVBUFFER_MAX_READ
	.comm	_EVBUFFER_CHAIN_MAX,8,3         ; @EVBUFFER_CHAIN_MAX
	.comm	_NUM_READ_IOVEC,4,2             ; @NUM_READ_IOVEC
	.comm	_WSAECONNABORTED,8,3            ; @WSAECONNABORTED
.subsections_via_symbols
