	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_evbuffer_add                   ## -- Begin function evbuffer_add
	.p2align	4, 0x90
_evbuffer_add:                          ## @evbuffer_add
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	callq	_EVBUFFER_LOCK
	movl	$-1, %r13d
	cmpq	$0, 24(%rbx)
	jne	LBB0_14
## %bb.1:
	movq	_EV_SIZE_MAX@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	subq	(%rbx), %rax
	cmpq	%r14, %rax
	jb	LBB0_14
## %bb.2:
	movq	16(%rbx), %r12
	testq	%r12, %r12
	jne	LBB0_5
## %bb.3:
	movq	%r14, %rdi
	callq	_evbuffer_chain_new
	testq	%rax, %rax
	je	LBB0_14
## %bb.4:
	movq	%rax, %r12
	movq	%rbx, %rdi
	movq	%rax, %rsi
	callq	_evbuffer_chain_insert
LBB0_5:
	movq	_EVBUFFER_IMMUTABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_11
## %bb.6:
	xorl	%eax, %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
LBB0_7:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	16(%r12), %rdi
	movq	_EVBUFFER_CHAIN_MAX_AUTO_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	sarl	%ecx
	movslq	%ecx, %rax
	cmpq	%rax, %rdi
	setbe	%cl
	shlq	%cl, %rdi
	cmpq	%r14, %rdi
	cmovbeq	%r14, %rdi
	callq	_evbuffer_chain_new
	testq	%rax, %rax
	je	LBB0_14
## %bb.8:
	movq	%rax, %r15
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	testq	%rax, %rax
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	je	LBB0_10
## %bb.9:
	movq	8(%r12), %rdi
	addq	32(%r12), %rdi
	addq	24(%r12), %rdi
	movq	%r13, %rsi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	callq	_memcpy
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	addq	%rax, 24(%r12)
	movdqu	(%rbx), %xmm0
	movq	%rax, %xmm1
	pshufd	$68, %xmm1, %xmm1               ## xmm1 = xmm1[0,1,0,1]
	paddq	%xmm0, %xmm1
	movdqu	%xmm1, (%rbx)
LBB0_10:
	addq	%rax, %r13
	subq	%rax, %r14
	movq	32(%r15), %rdi
	movq	%r13, %rsi
	movq	%r14, %rdx
	callq	_memcpy
	movq	%r14, 24(%r15)
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_evbuffer_chain_insert
	jmp	LBB0_13
LBB0_11:
	movq	8(%r12), %rax
	testq	%rax, %rax
	setns	%cl
	movq	_EVBUFFER_CHAIN_MAX@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rax
	setle	%al
	andb	%cl, %al
	movzbl	%al, %edi
	callq	_EVUTIL_ASSERT
	movq	8(%r12), %rdi
	movq	16(%r12), %rax
	addq	24(%r12), %rdi
	subq	%rdi, %rax
	cmpq	%r14, %rax
	jae	LBB0_12
## %bb.15:
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%r12, %rdi
	callq	_CHAIN_PINNED
	testl	%eax, %eax
	jne	LBB0_7
## %bb.16:
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_evbuffer_chain_should_realign
	testq	%rax, %rax
	je	LBB0_7
## %bb.17:
	movq	%r12, %rdi
	callq	_evbuffer_chain_align
	movq	24(%r12), %rdi
LBB0_12:
	addq	32(%r12), %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_memcpy
	addq	%r14, 24(%r12)
	addq	%r14, (%rbx)
LBB0_13:
	addq	%r14, 8(%rbx)
	movq	%rbx, %rdi
	callq	_evbuffer_invoke_callbacks_
	xorl	%r13d, %r13d
LBB0_14:
	movq	%rbx, %rdi
	callq	_EVBUFFER_UNLOCK
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EV_SIZE_MAX,8,3                ## @EV_SIZE_MAX
	.comm	_EVBUFFER_IMMUTABLE,4,2         ## @EVBUFFER_IMMUTABLE
	.comm	_EVBUFFER_CHAIN_MAX,8,3         ## @EVBUFFER_CHAIN_MAX
	.comm	_EVBUFFER_CHAIN_MAX_AUTO_SIZE,4,2 ## @EVBUFFER_CHAIN_MAX_AUTO_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_evbuffer_add                   ; -- Begin function evbuffer_add
	.p2align	2
_evbuffer_add:                          ; @evbuffer_add
	.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, x2
	mov	x21, x1
	mov	x19, x0
	bl	_EVBUFFER_LOCK
	ldr	x8, [x19, #24]
	cbnz	x8, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _EV_SIZE_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EV_SIZE_MAX@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	x9, [x19]
	sub	x8, x8, x9
	cmp	x8, x20
	b.hs	LBB0_4
LBB0_2:
	mov	w20, #-1
LBB0_3:
	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
LBB0_4:
	ldr	x22, [x19, #16]
	cbnz	x22, LBB0_7
; %bb.5:
	mov	x0, x20
	bl	_evbuffer_chain_new
	cbz	x0, LBB0_2
; %bb.6:
	mov	x22, x0
	mov	x0, x19
	mov	x1, x22
	bl	_evbuffer_chain_insert
LBB0_7:
	ldr	w8, [x22]
Lloh3:
	adrp	x9, _EVBUFFER_IMMUTABLE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _EVBUFFER_IMMUTABLE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_13
; %bb.8:
	mov	x23, #0
LBB0_9:
	ldr	x8, [x22, #16]
Lloh6:
	adrp	x9, _EVBUFFER_CHAIN_MAX_AUTO_SIZE@GOTPAGE
Lloh7:
	ldr	x9, [x9, _EVBUFFER_CHAIN_MAX_AUTO_SIZE@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	cmp	w9, #0
	cinc	w9, w9, lt
	asr	w9, w9, #1
	cmp	x8, w9, sxtw
	cset	w9, ls
	lsl	x8, x8, x9
	cmp	x8, x20
	csel	x0, x8, x20, hi
	bl	_evbuffer_chain_new
	cbz	x0, LBB0_2
; %bb.10:
	mov	x24, x0
	cbz	x23, LBB0_12
; %bb.11:
	ldr	x8, [x22, #8]
	ldp	x10, x9, [x22, #24]
	add	x8, x8, x9
	add	x0, x8, x10
	mov	x1, x21
	mov	x2, x23
	bl	_memcpy
	ldr	x8, [x22, #24]
	add	x8, x8, x23
	str	x8, [x22, #24]
	ldr	q0, [x19]
	dup.2d	v1, x23
	add.2d	v0, v0, v1
	str	q0, [x19]
LBB0_12:
	add	x1, x21, x23
	sub	x20, x20, x23
	ldr	x0, [x24, #32]
	mov	x2, x20
	bl	_memcpy
	str	x20, [x24, #24]
	mov	x0, x19
	mov	x1, x24
	bl	_evbuffer_chain_insert
	b	LBB0_19
LBB0_13:
	ldr	x8, [x22, #8]
	cmp	x8, #0
Lloh9:
	adrp	x9, _EVBUFFER_CHAIN_MAX@GOTPAGE
Lloh10:
	ldr	x9, [x9, _EVBUFFER_CHAIN_MAX@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	ccmp	x8, x9, #0, ge
	cset	w0, le
	bl	_EVUTIL_ASSERT
	ldp	x8, x9, [x22, #8]
	ldr	x10, [x22, #24]
	add	x8, x8, x10
	sub	x23, x9, x8
	cmp	x23, x20
	b.hs	LBB0_17
; %bb.14:
	mov	x0, x22
	bl	_CHAIN_PINNED
	cbnz	w0, LBB0_9
; %bb.15:
	mov	x0, x22
	mov	x1, x20
	bl	_evbuffer_chain_should_realign
	cbz	x0, LBB0_9
; %bb.16:
	mov	x0, x22
	bl	_evbuffer_chain_align
	ldp	x9, x8, [x22, #24]
	add	x0, x9, x8
	b	LBB0_18
LBB0_17:
	ldr	x9, [x22, #32]
	add	x0, x8, x9
LBB0_18:
	mov	x1, x21
	mov	x2, x20
	bl	_memcpy
	ldr	x8, [x22, #24]
	add	x8, x8, x20
	str	x8, [x22, #24]
	ldr	x8, [x19]
	add	x8, x8, x20
	str	x8, [x19]
LBB0_19:
	ldr	x8, [x19, #8]
	add	x8, x8, x20
	str	x8, [x19, #8]
	mov	x0, x19
	bl	_evbuffer_invoke_callbacks_
	mov	w20, #0
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_EV_SIZE_MAX,8,3                ; @EV_SIZE_MAX
	.comm	_EVBUFFER_IMMUTABLE,4,2         ; @EVBUFFER_IMMUTABLE
	.comm	_EVBUFFER_CHAIN_MAX,8,3         ; @EVBUFFER_CHAIN_MAX
	.comm	_EVBUFFER_CHAIN_MAX_AUTO_SIZE,4,2 ; @EVBUFFER_CHAIN_MAX_AUTO_SIZE
.subsections_via_symbols
