	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function buffer_write
_buffer_write:                          ## @buffer_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorl	%r14d, %r14d
	testq	%rsi, %rsi
	je	LBB0_19
## %bb.1:
	movl	%edx, %r13d
	testl	%edx, %edx
	jle	LBB0_19
## %bb.2:
	movq	8(%rdi), %r12
	testq	%r12, %r12
	je	LBB0_19
## %bb.3:
	cmpq	$0, (%rdi)
	je	LBB0_19
## %bb.4:
	movq	%rsi, %r15
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_BIO_clear_retry_flags
	movl	(%r12), %ebx
	movl	4(%r12), %edx
	movl	8(%r12), %eax
	leal	(%rax,%rdx), %ecx
	subl	%ecx, %ebx
	xorl	%r14d, %r14d
	cmpl	%r13d, %ebx
	jge	LBB0_13
## %bb.5:
	xorl	%r14d, %r14d
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_9 Depth 2
                                        ##     Child Loop BB0_16 Depth 2
	testl	%edx, %edx
	je	LBB0_15
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	testl	%ebx, %ebx
	jle	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movslq	%ecx, %rdi
	addq	16(%r12), %rdi
	movq	%r15, %rsi
	movl	%ebx, %edx
	callq	_memcpy
	movl	%ebx, %eax
	addq	%rax, %r15
	subl	%ebx, %r13d
	addl	%ebx, %r14d
	addl	4(%r12), %ebx
	movl	%ebx, 4(%r12)
	movl	8(%r12), %eax
	movl	%ebx, %edx
	.p2align	4, 0x90
LBB0_9:                                 ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx), %rdi
	movslq	%eax, %rsi
	addq	16(%r12), %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_BIO_write
	movl	%eax, %ebx
	testl	%eax, %eax
	jle	LBB0_10
## %bb.14:                              ##   in Loop: Header=BB0_9 Depth=2
	movl	8(%r12), %eax
	addl	%ebx, %eax
	movl	%eax, 8(%r12)
	movl	4(%r12), %edx
	subl	%ebx, %edx
	movl	%edx, 4(%r12)
	jne	LBB0_9
LBB0_15:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	$0, 8(%r12)
	.p2align	4, 0x90
LBB0_16:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r12), %ebx
	cmpl	%ebx, %r13d
	jl	LBB0_12
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=2
	movq	(%rax), %rdi
	movq	%r15, %rsi
	movl	%r13d, %edx
	callq	_BIO_write
	movl	%eax, %ebx
	testl	%eax, %eax
	jle	LBB0_10
## %bb.18:                              ##   in Loop: Header=BB0_16 Depth=2
	addl	%ebx, %r14d
	movl	%ebx, %eax
	addq	%rax, %r15
	subl	%ebx, %r13d
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	jne	LBB0_16
	jmp	LBB0_19
LBB0_12:                                ##   in Loop: Header=BB0_6 Depth=1
	movl	4(%r12), %edx
	movl	8(%r12), %eax
	leal	(%rax,%rdx), %ecx
	subl	%ecx, %ebx
	cmpl	%ebx, %r13d
	jg	LBB0_6
LBB0_13:
	movslq	%ecx, %rdi
	addq	16(%r12), %rdi
	movq	%r15, %rsi
	movl	%r13d, %edx
	callq	_memcpy
	addl	%r13d, 4(%r12)
	addl	%r13d, %r14d
	jmp	LBB0_19
LBB0_10:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_BIO_copy_next_retry
	testl	%ebx, %ebx
	jns	LBB0_19
## %bb.11:
	testl	%r14d, %r14d
	cmovlel	%ebx, %r14d
LBB0_19:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_buffer_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function buffer_write
_buffer_write:                          ; @buffer_write
	.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	w19, #0
	cbz	x1, LBB0_22
; %bb.1:
	mov	x20, x2
	cmp	w2, #1
	b.lt	LBB0_22
; %bb.2:
	mov	x22, x0
	ldr	x24, [x0, #8]
	cbz	x24, LBB0_16
; %bb.3:
	ldr	x8, [x22]
	cbz	x8, LBB0_16
; %bb.4:
	mov	x21, x1
	mov	x0, x22
	bl	_BIO_clear_retry_flags
	ldp	w10, w2, [x24]
	ldr	w8, [x24, #8]
	add	w9, w8, w2
	sub	w23, w10, w9
	cmp	w23, w20
	b.ge	LBB0_17
; %bb.5:
	mov	w19, #0
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
                                        ;     Child Loop BB0_12 Depth 2
	cbz	w2, LBB0_11
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	cmp	w23, #1
	b.lt	LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x24, #16]
	add	x0, x8, w9, sxtw
	mov	x1, x21
	mov	x2, x23
	bl	_memcpy
	add	x21, x21, w23, uxtw
	sub	w20, w20, w23
	add	w19, w23, w19
	ldp	w9, w8, [x24, #4]
	add	w2, w9, w23
	str	w2, [x24, #4]
LBB0_9:                                 ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x0, [x22]
	ldr	x9, [x24, #16]
	add	x1, x9, w8, sxtw
	bl	_BIO_write
	mov	x23, x0
	cmp	w0, #0
	b.le	LBB0_19
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=2
	ldp	w9, w8, [x24, #4]
	add	w8, w8, w23
	subs	w2, w9, w23
	stp	w2, w8, [x24, #4]
	b.ne	LBB0_9
LBB0_11:                                ;   in Loop: Header=BB0_6 Depth=1
	str	wzr, [x24, #8]
LBB0_12:                                ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w10, [x24]
	cmp	w20, w10
	b.lt	LBB0_15
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=2
	ldr	x0, [x22]
	mov	x1, x21
	mov	x2, x20
	bl	_BIO_write
	mov	x23, x0
	cmp	w0, #0
	b.le	LBB0_21
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=2
	add	w19, w23, w19
	add	x21, x21, w23, uxtw
	subs	w20, w20, w23
	b.ne	LBB0_12
	b	LBB0_22
LBB0_15:                                ;   in Loop: Header=BB0_6 Depth=1
	ldp	w2, w8, [x24, #4]
	add	w9, w8, w2
	sub	w23, w10, w9
	cmp	w20, w23
	b.gt	LBB0_6
	b	LBB0_18
LBB0_16:
	mov	w19, #0
	b	LBB0_22
LBB0_17:
	mov	w19, #0
LBB0_18:
	ldr	x8, [x24, #16]
	add	x0, x8, w9, sxtw
	mov	x1, x21
	mov	x2, x20
	bl	_memcpy
	ldr	w8, [x24, #4]
	add	w8, w8, w20
	str	w8, [x24, #4]
	add	w19, w19, w20
	b	LBB0_22
LBB0_19:
	mov	x0, x22
	bl	_BIO_copy_next_retry
	tbz	w23, #31, LBB0_22
; %bb.20:
	cmp	w19, #0
	csel	w19, w19, w23, gt
	b	LBB0_22
LBB0_21:
	mov	x0, x22
	bl	_BIO_copy_next_retry
	cmp	w19, #0
	csel	w8, w19, w23, gt
	tst	w23, #0x80000000
	csel	w19, w19, w8, eq
LBB0_22:
	mov	x0, x19
	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
	.no_dead_strip	_buffer_write
.subsections_via_symbols
