	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_LSAPI_Finish_r                 ## -- Begin function LSAPI_Finish_r
	.p2align	4, 0x90
_LSAPI_Finish_r:                        ## @LSAPI_Finish_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	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.2:
	movq	%rdi, %rbx
	movl	(%rdi), %eax
	xorl	%r14d, %r14d
	testl	%eax, %eax
	je	LBB0_10
## %bb.3:
	cmpl	$-1, 4(%rbx)
	je	LBB0_9
## %bb.4:
	movq	_LSAPI_ST_RESP_HEADER@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_6
## %bb.5:
	movq	%rbx, %rdi
	callq	_LSAPI_FinalizeRespHeaders_r
LBB0_6:
	movq	8(%rbx), %rax
	cmpq	16(%rbx), %rax
	je	LBB0_8
## %bb.7:
	movq	%rbx, %rdi
	callq	_Flush_RespBuf_r
LBB0_8:
	movq	_finish_close@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	24(%rbx), %rcx
	movq	%rax, 8(%rcx)
	movq	_LSAPI_PACKET_HEADER_LEN@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	%rdx, (%rcx)
	movl	(%rax), %eax
	addl	%eax, 32(%rbx)
	addq	$16, %rcx
	movq	%rcx, 24(%rbx)
	movq	%rbx, %rdi
	callq	_LSAPI_Flush_r
LBB0_9:
	movq	%rbx, %rdi
	callq	_LSAPI_Reset_r
	jmp	LBB0_10
LBB0_1:
	movl	$-1, %r14d
LBB0_10:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_LSAPI_ST_RESP_HEADER,4,2       ## @LSAPI_ST_RESP_HEADER
	.comm	_finish_close,8,3               ## @finish_close
	.comm	_LSAPI_PACKET_HEADER_LEN,8,3    ## @LSAPI_PACKET_HEADER_LEN
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_LSAPI_Finish_r                 ; -- Begin function LSAPI_Finish_r
	.p2align	2
_LSAPI_Finish_r:                        ; @LSAPI_Finish_r
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	cbz	x0, LBB0_10
; %bb.1:
	mov	x19, x0
	ldr	w8, [x0]
	cbz	w8, LBB0_9
; %bb.2:
	ldr	w9, [x19, #4]
	cmn	w9, #1
	b.eq	LBB0_8
; %bb.3:
Lloh0:
	adrp	x9, _LSAPI_ST_RESP_HEADER@GOTPAGE
Lloh1:
	ldr	x9, [x9, _LSAPI_ST_RESP_HEADER@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.4:
	mov	x0, x19
	bl	_LSAPI_FinalizeRespHeaders_r
LBB0_5:
	ldp	x8, x9, [x19, #8]
	cmp	x8, x9
	b.eq	LBB0_7
; %bb.6:
	mov	x0, x19
	bl	_Flush_RespBuf_r
LBB0_7:
Lloh3:
	adrp	x8, _finish_close@GOTPAGE
Lloh4:
	ldr	x8, [x8, _finish_close@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	ldr	x9, [x19, #24]
Lloh6:
	adrp	x10, _LSAPI_PACKET_HEADER_LEN@GOTPAGE
Lloh7:
	ldr	x10, [x10, _LSAPI_PACKET_HEADER_LEN@GOTPAGEOFF]
	ldr	x11, [x10]
	stp	x11, x8, [x9]
	ldr	w8, [x10]
	ldr	w10, [x19, #32]
	add	w8, w10, w8
	str	w8, [x19, #32]
	add	x8, x9, #16
	str	x8, [x19, #24]
	mov	x0, x19
	bl	_LSAPI_Flush_r
LBB0_8:
	mov	x0, x19
	bl	_LSAPI_Reset_r
LBB0_9:
	mov	w0, #0
	b	LBB0_11
LBB0_10:
	mov	w0, #-1
LBB0_11:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_LSAPI_ST_RESP_HEADER,4,2       ; @LSAPI_ST_RESP_HEADER
	.comm	_finish_close,8,3               ; @finish_close
	.comm	_LSAPI_PACKET_HEADER_LEN,8,3    ; @LSAPI_PACKET_HEADER_LEN
.subsections_via_symbols
