	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_LSAPI_Write_r                  ## -- Begin function LSAPI_Write_r
	.p2align	4, 0x90
_LSAPI_Write_r:                         ## @LSAPI_Write_r
	.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
	movl	$-1, %eax
	testq	%rdi, %rdi
	je	LBB0_4
## %bb.1:
	movq	%rsi, %r14
	testq	%rsi, %rsi
	je	LBB0_4
## %bb.2:
	movq	%rdx, %rbx
	movq	%rdi, %r13
	movl	(%rdi), %edx
	movq	_LSAPI_ST_BACKGROUND@GOTPCREL(%rip), %rcx
	testl	%edx, (%rcx)
	je	LBB0_5
LBB0_3:
	movl	%ebx, %eax
LBB0_4:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	cmpl	$-1, 4(%r13)
	je	LBB0_4
## %bb.6:
	movq	_LSAPI_ST_RESP_HEADER@GOTPCREL(%rip), %rcx
	testl	%edx, (%rcx)
	je	LBB0_8
## %bb.7:
	movq	%r13, %rdi
	callq	_LSAPI_FinalizeRespHeaders_r
	movl	(%r13), %edx
LBB0_8:
	movq	_LSAPI_ST_RESP_BODY@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edx
	movl	%edx, (%r13)
	movl	8(%r13), %eax
	movl	12(%r13), %r12d
	subl	%r12d, %eax
	cmpl	%ebx, %eax
	jle	LBB0_10
## %bb.9:
	movl	%r12d, %edi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_memmove
	addl	%ebx, 12(%r13)
	jmp	LBB0_3
LBB0_10:
	movq	%r14, %r15
	testl	%ebx, %ebx
	jle	LBB0_23
## %bb.11:
	movq	%rbx, %rax
	addq	%r14, %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	subl	16(%r13), %r12d
	movq	24(%r13), %rdi
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	%r14, %r15
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_13 Depth=1
	movslq	%r14d, %rax
	addq	%rax, %r15
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
                                        ## kill: def $ebx killed $ebx killed $rbx def $rbx
	subl	%r15d, %ebx
	testl	%ebx, %ebx
	jle	LBB0_19
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	leal	(%rbx,%r12), %eax
	movq	%r13, %r15
	movq	%r12, %r13
	movq	_LSAPI_MAX_DATA_PACKET_LEN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r12d
	movl	%r12d, %r14d
	subl	%r13d, %r14d
	cmpl	%eax, %r12d
	cmovgel	%ebx, %r14d
	cmovgel	%eax, %r12d
	movq	_LSAPI_RESP_STREAM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_LSAPI_PACKET_HEADER_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	addl	%r12d, %edx
	movq	%rdi, %rbx
	callq	_lsapi_buildPacketHeader
	movq	%rbx, %rdi
	movq	_LSAPI_PACKET_HEADER_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	addl	%ecx, %r12d
	addl	%r12d, 48(%r15)
	movq	%r13, %r12
	movq	%r15, %r13
	movq	40(%r15), %rax
	movq	%rbx, 8(%rax)
	movl	%ecx, (%rax)
	addq	$4, %rdi
	testl	%r12d, %r12d
	jg	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	addq	$16, %rax
	jmp	LBB0_16
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_13 Depth=1
	movslq	16(%r13), %rcx
	movq	%rcx, 24(%rax)
	movl	%r12d, 16(%rax)
	movl	%ecx, 12(%r13)
	addq	$32, %rax
	xorl	%r12d, %r12d
LBB0_16:                                ##   in Loop: Header=BB0_13 Depth=1
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, 8(%rax)
	movl	%r14d, (%rax)
	addq	$16, %rax
	movq	%rax, 40(%r13)
	movq	32(%r13), %rax
	addq	$-4, %rax
	cmpq	%rax, %rdi
	jb	LBB0_12
## %bb.17:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	%r13, %rdi
	callq	_LSAPI_Flush_r
	cmpl	$-1, %eax
	je	LBB0_21
## %bb.18:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	24(%r13), %rdi
	jmp	LBB0_12
LBB0_19:
	cmpq	24(%r13), %rdi
	je	LBB0_22
## %bb.20:
	movq	%r13, %rdi
	callq	_LSAPI_Flush_r
	cmpl	$-1, %eax
	movl	$-1, %eax
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	jne	LBB0_23
	jmp	LBB0_4
LBB0_21:
	movl	$-1, %eax
	jmp	LBB0_4
LBB0_22:
	movq	-48(%rbp), %r14                 ## 8-byte Reload
LBB0_23:
	subl	%r14d, %r15d
	movl	%r15d, %eax
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.comm	_LSAPI_ST_BACKGROUND,4,2        ## @LSAPI_ST_BACKGROUND
	.comm	_LSAPI_ST_RESP_HEADER,4,2       ## @LSAPI_ST_RESP_HEADER
	.comm	_LSAPI_ST_RESP_BODY,4,2         ## @LSAPI_ST_RESP_BODY
	.comm	_LSAPI_MAX_DATA_PACKET_LEN,4,2  ## @LSAPI_MAX_DATA_PACKET_LEN
	.comm	_LSAPI_RESP_STREAM,4,2          ## @LSAPI_RESP_STREAM
	.comm	_LSAPI_PACKET_HEADER_LEN,4,2    ## @LSAPI_PACKET_HEADER_LEN
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_LSAPI_Write_r                  ; -- Begin function LSAPI_Write_r
	.p2align	2
_LSAPI_Write_r:                         ; @LSAPI_Write_r
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x20, x0
	mov	w0, #-1
	cbz	x20, LBB0_4
; %bb.1:
	mov	x19, x1
	cbz	x1, LBB0_4
; %bb.2:
	mov	x21, x2
	ldr	w8, [x20]
Lloh0:
	adrp	x9, _LSAPI_ST_BACKGROUND@GOTPAGE
Lloh1:
	ldr	x9, [x9, _LSAPI_ST_BACKGROUND@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
LBB0_3:
	mov	x0, x21
LBB0_4:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_5:
	ldr	w9, [x20, #4]
	cmn	w9, #1
	b.eq	LBB0_10
; %bb.6:
Lloh3:
	adrp	x9, _LSAPI_ST_RESP_HEADER@GOTPAGE
Lloh4:
	ldr	x9, [x9, _LSAPI_ST_RESP_HEADER@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.7:
	mov	x0, x20
	bl	_LSAPI_FinalizeRespHeaders_r
	ldr	w8, [x20]
LBB0_8:
Lloh6:
	adrp	x9, _LSAPI_ST_RESP_BODY@GOTPAGE
Lloh7:
	ldr	x9, [x9, _LSAPI_ST_RESP_BODY@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w8, w8, w9
	str	w8, [x20]
	ldp	w8, w0, [x20, #8]
	sub	w8, w8, w0
	cmp	w8, w21
	b.le	LBB0_11
; %bb.9:
	mov	x1, x19
	mov	x2, x21
	bl	_memmove
	ldr	w8, [x20, #12]
	add	w8, w8, w21
	str	w8, [x20, #12]
	b	LBB0_3
LBB0_10:
	mov	w0, #-1
	b	LBB0_4
LBB0_11:
	mov	x23, x19
	cmp	w21, #1
	b.lt	LBB0_22
; %bb.12:
	add	x24, x19, x21
	ldr	x22, [x20, #24]
	ldr	w8, [x20, #16]
	sub	w28, w0, w8
Lloh9:
	adrp	x26, _LSAPI_RESP_STREAM@GOTPAGE
Lloh10:
	ldr	x26, [x26, _LSAPI_RESP_STREAM@GOTPAGEOFF]
Lloh11:
	adrp	x27, _LSAPI_PACKET_HEADER_LEN@GOTPAGE
Lloh12:
	ldr	x27, [x27, _LSAPI_PACKET_HEADER_LEN@GOTPAGEOFF]
	mov	x23, x19
	b	LBB0_14
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=1
	add	x23, x23, w21, sxtw
	sub	w21, w24, w23
	cmp	w21, #0
	b.le	LBB0_20
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
Lloh13:
	adrp	x8, _LSAPI_MAX_DATA_PACKET_LEN@GOTPAGE
Lloh14:
	ldr	x8, [x8, _LSAPI_MAX_DATA_PACKET_LEN@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	sub	w9, w8, w28
	add	w10, w21, w28
	cmp	w8, w10
	csel	w21, w9, w21, lt
	csel	w25, w8, w10, lt
	ldr	w1, [x26]
	ldr	w8, [x27]
	add	w2, w8, w25
	mov	x0, x22
	bl	_lsapi_buildPacketHeader
	ldr	w9, [x27]
	ldr	w8, [x20, #48]
	add	w10, w9, w25
	add	w8, w10, w8
	str	w8, [x20, #48]
	ldr	x8, [x20, #40]
	str	x22, [x8, #8]
	str	w9, [x8]
	cmp	w28, #1
	b.ge	LBB0_16
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	add	x8, x8, #16
	b	LBB0_17
LBB0_16:                                ;   in Loop: Header=BB0_14 Depth=1
	ldrsw	x9, [x20, #16]
	str	x9, [x8, #24]
	str	w28, [x8, #16]
	str	w9, [x20, #12]
	add	x8, x8, #32
	mov	w28, #0
LBB0_17:                                ;   in Loop: Header=BB0_14 Depth=1
	add	x22, x22, #4
	str	x23, [x8, #8]
	str	w21, [x8], #16
	str	x8, [x20, #40]
	ldr	x8, [x20, #32]
	sub	x8, x8, #4
	cmp	x22, x8
	b.lo	LBB0_13
; %bb.18:                               ;   in Loop: Header=BB0_14 Depth=1
	mov	x0, x20
	bl	_LSAPI_Flush_r
	cmn	w0, #1
	b.eq	LBB0_4
; %bb.19:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	x22, [x20, #24]
	b	LBB0_13
LBB0_20:
	ldr	x8, [x20, #24]
	cmp	x22, x8
	b.eq	LBB0_22
; %bb.21:
	mov	x0, x20
	bl	_LSAPI_Flush_r
	cmn	w0, #1
	b.eq	LBB0_4
LBB0_22:
	sub	w0, w23, w19
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_LSAPI_ST_BACKGROUND,4,2        ; @LSAPI_ST_BACKGROUND
	.comm	_LSAPI_ST_RESP_HEADER,4,2       ; @LSAPI_ST_RESP_HEADER
	.comm	_LSAPI_ST_RESP_BODY,4,2         ; @LSAPI_ST_RESP_BODY
	.comm	_LSAPI_MAX_DATA_PACKET_LEN,4,2  ; @LSAPI_MAX_DATA_PACKET_LEN
	.comm	_LSAPI_RESP_STREAM,4,2          ; @LSAPI_RESP_STREAM
	.comm	_LSAPI_PACKET_HEADER_LEN,4,2    ; @LSAPI_PACKET_HEADER_LEN
.subsections_via_symbols
