	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ds_write
_ds_write:                              ## @ds_write
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdx, -80(%rbp)                 ## 8-byte Spill
	testq	%rdx, %rdx
	je	LBB0_3
## %bb.1:
	testq	%rcx, %rcx
	je	LBB0_2
## %bb.4:
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	movq	_ds_index@GOTPCREL(%rip), %r15
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_5 Depth=1
	addq	%r12, -80(%rbp)                 ## 8-byte Folded Spill
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	addl	%r12d, %eax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	testq	%rcx, %rcx
	je	LBB0_13
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movl	(%r14), %edi
	movq	_ds_buffer_base@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	-44(%rbp), %r12d                ## 4-byte Reload
	movl	%r12d, %esi
	callq	_ds_get
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	movl	(%r14), %edi
	movl	(%r15), %edx
	movl	%r12d, %esi
	callq	_ds_get
	movq	%rax, %r13
	movl	(%r14), %edi
	movq	_ds_absolute_maximum@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r12d, %esi
	callq	_ds_get
	movq	%rax, %r15
	movl	(%r14), %edi
	movq	_ds_interrupt_threshold@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r12d, %esi
	callq	_ds_get
	movq	%rax, %rbx
	movq	%r15, %rdi
	movq	%rax, %rsi
	callq	_min
	cmpq	%r13, %rax
	cmovbeq	%r15, %rax
	subq	%r13, %rax
	jbe	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	movq	%rax, %rsi
	callq	_min
	movq	%rax, %r12
	movq	%r13, %rdi
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movq	%rax, %rdx
	callq	_memcpy
	movq	_ds_cfg@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rax,%rcx,8), %rcx
	movq	%r12, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	movq	%rbx, -96(%rbp)                 ## 8-byte Spill
	je	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	%r12, %rax
	xorl	%edx, %edx
	divq	%rcx
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_5 Depth=1
	movl	%r12d, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=1
	subq	%r12, %r14
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movq	%r12, %rbx
	subq	%rdx, %rbx
	leaq	(%r12,%r13), %rdi
	negq	%rdx
	xorl	%esi, %esi
	callq	_memset
	addq	%r13, %rbx
	cmpq	%r15, %rbx
	movq	-104(%rbp), %r14                ## 8-byte Reload
	cmovbq	%rbx, %r14
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	movq	_ds_index@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	%r14, %rcx
	callq	_ds_set
	cmpq	-96(%rbp), %r14                 ## 8-byte Folded Reload
	jb	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_ds_overflow
	jmp	LBB0_12
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_13
LBB0_2:
	xorl	%eax, %eax
	jmp	LBB0_13
LBB0_6:
	movq	-72(%rbp), %rax                 ## 8-byte Reload
LBB0_13:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ds_buffer_base,4,2             ## @ds_buffer_base
	.comm	_ds_index,4,2                   ## @ds_index
	.comm	_ds_absolute_maximum,4,2        ## @ds_absolute_maximum
	.comm	_ds_interrupt_threshold,4,2     ## @ds_interrupt_threshold
	.comm	_ds_cfg,8,3                     ## @ds_cfg
	.no_dead_strip	_ds_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ds_write
_ds_write:                              ; @ds_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	cbz	x2, LBB0_7
; %bb.1:
	mov	x20, x3
	cbz	x3, LBB0_8
; %bb.2:
	mov	x21, x2
	mov	x26, x1
	mov	x22, x0
	mov	w28, #0
Lloh0:
	adrp	x23, _ds_index@GOTPAGE
Lloh1:
	ldr	x23, [x23, _ds_index@GOTPAGEOFF]
	mov	w8, w1
	str	x8, [sp, #8]                    ; 8-byte Folded Spill
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x21, x21, x28
	ldr	w8, [sp, #20]                   ; 4-byte Folded Reload
	add	w28, w8, w28
	ldr	x20, [sp, #24]                  ; 8-byte Folded Reload
	cbz	x20, LBB0_9
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x22]
Lloh2:
	adrp	x8, _ds_buffer_base@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ds_buffer_base@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x8]
	mov	x1, x26
	bl	_ds_get
	mov	x24, x0
	ldr	w0, [x22]
	ldr	w2, [x23]
	mov	x1, x26
	bl	_ds_get
	mov	x25, x0
	ldr	w0, [x22]
Lloh5:
	adrp	x8, _ds_absolute_maximum@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ds_absolute_maximum@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	mov	x1, x26
	bl	_ds_get
	mov	x27, x0
	ldr	w0, [x22]
Lloh8:
	adrp	x8, _ds_interrupt_threshold@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ds_interrupt_threshold@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	mov	x1, x26
	bl	_ds_get
	mov	x19, x0
	mov	x0, x27
	mov	x1, x19
	bl	_min
	cmp	x0, x25
	csel	x8, x0, x27, hi
	subs	x1, x8, x25
	b.ls	LBB0_9
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	str	w28, [sp, #20]                  ; 4-byte Folded Spill
	mov	x0, x20
	bl	_min
	mov	x28, x0
	mov	x0, x25
	mov	x1, x21
	mov	x2, x28
	bl	_memcpy
	sub	x20, x20, x28
	str	x20, [sp, #24]                  ; 8-byte Folded Spill
Lloh11:
	adrp	x8, _ds_cfg@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ds_cfg@GOTPAGEOFF]
Lloh13:
	ldr	x8, [x8]
	ldr	x9, [sp, #8]                    ; 8-byte Folded Reload
	ldr	x8, [x8, x9, lsl #3]
	udiv	x9, x28, x8
	mul	x20, x9, x8
	add	x0, x25, x28
	sub	x2, x20, x28
	mov	w1, #0
	bl	_memset
	add	x8, x20, x25
	cmp	x8, x27
	csel	x24, x8, x24, lo
	ldr	w0, [x22]
	ldr	w2, [x23]
	mov	x1, x26
	mov	x3, x24
	bl	_ds_set
	cmp	x24, x19
	b.lo	LBB0_3
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x22
	mov	x1, x26
	bl	_ds_overflow
	b	LBB0_3
LBB0_7:
Lloh14:
	adrp	x8, _EINVAL@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	neg	w28, w8
	b	LBB0_9
LBB0_8:
	mov	w28, #0
LBB0_9:
	mov	x0, x28
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ds_buffer_base,4,2             ; @ds_buffer_base
	.comm	_ds_index,4,2                   ; @ds_index
	.comm	_ds_absolute_maximum,4,2        ; @ds_absolute_maximum
	.comm	_ds_interrupt_threshold,4,2     ; @ds_interrupt_threshold
	.comm	_ds_cfg,8,3                     ; @ds_cfg
	.no_dead_strip	_ds_write
.subsections_via_symbols
