	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function unixLockSharedMemory
_unixLockSharedMemory:                  ## @unixLockSharedMemory
	.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	%rsi, %r15
	movq	%rdi, %r14
	movq	_SQLITE_OK@GOTPCREL(%rip), %r13
	movl	(%r13), %ebx
	movq	_SEEK_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)
	movq	_UNIX_SHM_DMS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)
	movl	$1, -64(%rbp)
	movq	_F_WRLCK@GOTPCREL(%rip), %r12
	movq	(%r12), %rax
	movq	%rax, -56(%rbp)
	movl	8(%rsi), %edi
	movq	_F_GETLK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-64(%rbp), %rdx
	callq	_osFcntl
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	_SQLITE_IOERR_LOCK@GOTPCREL(%rip), %rax
LBB0_10:
	movl	(%rax), %ebx
LBB0_11:
	cmpl	(%r13), %ebx
	jne	LBB0_13
## %bb.12:
	movq	-56(%rbp), %rax
	movq	_F_UNLCK@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	sete	%cl
	movq	_F_RDLCK@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rax
	sete	%al
	orb	%cl, %al
	movzbl	%al, %edi
	callq	_assert
	movq	(%rbx), %rsi
	movq	_UNIX_SHM_DMS@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movl	$1, %ecx
	callq	_unixShmSystemLock
	movl	%eax, %ebx
LBB0_13:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	-56(%rbp), %rax
	movq	_F_UNLCK@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_8
## %bb.3:
	cmpq	$0, 16(%r15)
	je	LBB0_5
## %bb.4:
	movl	$1, (%r15)
	movq	_SQLITE_READONLY_CANTINIT@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_8:
	cmpq	(%r12), %rax
	jne	LBB0_11
## %bb.9:
	movq	_SQLITE_BUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_5:
	movq	(%r12), %rsi
	movq	_UNIX_SHM_DMS@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movl	$1, %ecx
	callq	_unixShmSystemLock
	movl	%eax, %ebx
	cmpl	(%r13), %eax
	jne	LBB0_11
## %bb.6:
	movl	8(%r15), %edi
	movl	$3, %esi
	callq	_robust_ftruncate
	testq	%rax, %rax
	je	LBB0_11
## %bb.7:
	movq	_SQLITE_IOERR_SHMOPEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	4(%r15), %edx
	leaq	L_.str(%rip), %rsi
	callq	_unixLogError
	movl	%eax, %ebx
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_SQLITE_OK,4,2                  ## @SQLITE_OK
	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
	.comm	_UNIX_SHM_DMS,4,2               ## @UNIX_SHM_DMS
	.comm	_F_WRLCK,8,3                    ## @F_WRLCK
	.comm	_F_GETLK,4,2                    ## @F_GETLK
	.comm	_SQLITE_IOERR_LOCK,4,2          ## @SQLITE_IOERR_LOCK
	.comm	_F_UNLCK,8,3                    ## @F_UNLCK
	.comm	_SQLITE_READONLY_CANTINIT,4,2   ## @SQLITE_READONLY_CANTINIT
	.comm	_SQLITE_IOERR_SHMOPEN,4,2       ## @SQLITE_IOERR_SHMOPEN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ftruncate"

	.comm	_SQLITE_BUSY,4,2                ## @SQLITE_BUSY
	.comm	_F_RDLCK,8,3                    ## @F_RDLCK
	.no_dead_strip	_unixLockSharedMemory
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function unixLockSharedMemory
_unixLockSharedMemory:                  ; @unixLockSharedMemory
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x23, _SQLITE_OK@GOTPAGE
Lloh1:
	ldr	x23, [x23, _SQLITE_OK@GOTPAGEOFF]
	ldr	w21, [x23]
Lloh2:
	adrp	x8, _SEEK_SET@GOTPAGE
Lloh3:
	ldr	x8, [x8, _SEEK_SET@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x22, _UNIX_SHM_DMS@GOTPAGE
Lloh6:
	ldr	x22, [x22, _UNIX_SHM_DMS@GOTPAGEOFF]
	ldr	w9, [x22]
	stp	w9, w8, [sp, #24]
	mov	w8, #1
	str	w8, [sp, #8]
Lloh7:
	adrp	x24, _F_WRLCK@GOTPAGE
Lloh8:
	ldr	x24, [x24, _F_WRLCK@GOTPAGEOFF]
	ldr	x8, [x24]
	str	x8, [sp, #16]
	ldr	w0, [x1, #8]
Lloh9:
	adrp	x8, _F_GETLK@GOTPAGE
Lloh10:
	ldr	x8, [x8, _F_GETLK@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	add	x2, sp, #8
	bl	_osFcntl
	cbz	x0, LBB0_2
; %bb.1:
Lloh12:
	adrp	x8, _SQLITE_IOERR_LOCK@GOTPAGE
Lloh13:
	ldr	x8, [x8, _SQLITE_IOERR_LOCK@GOTPAGEOFF]
Lloh14:
	ldr	w21, [x8]
	b	LBB0_6
LBB0_2:
	ldr	x8, [sp, #16]
Lloh15:
	adrp	x9, _F_UNLCK@GOTPAGE
Lloh16:
	ldr	x9, [x9, _F_UNLCK@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.3:
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_9
; %bb.4:
	mov	w8, #1
	str	w8, [x20]
Lloh18:
	adrp	x8, _SQLITE_READONLY_CANTINIT@GOTPAGE
Lloh19:
	ldr	x8, [x8, _SQLITE_READONLY_CANTINIT@GOTPAGEOFF]
Lloh20:
	ldr	w21, [x8]
	b	LBB0_6
LBB0_5:
	ldr	x9, [x24]
Lloh21:
	adrp	x10, _SQLITE_BUSY@GOTPAGE
Lloh22:
	ldr	x10, [x10, _SQLITE_BUSY@GOTPAGEOFF]
Lloh23:
	ldr	w10, [x10]
	cmp	x8, x9
	csel	w21, w10, w21, eq
LBB0_6:
	ldr	w8, [x23]
	cmp	w21, w8
	b.ne	LBB0_8
; %bb.7:
	ldr	x8, [sp, #16]
Lloh24:
	adrp	x9, _F_UNLCK@GOTPAGE
Lloh25:
	ldr	x9, [x9, _F_UNLCK@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
	cmp	x8, x9
Lloh27:
	adrp	x20, _F_RDLCK@GOTPAGE
Lloh28:
	ldr	x20, [x20, _F_RDLCK@GOTPAGEOFF]
	ldr	x9, [x20]
	ccmp	x8, x9, #4, ne
	cset	w0, eq
	bl	_assert
	ldr	x1, [x20]
	ldr	w2, [x22]
	mov	x0, x19
	mov	w3, #1
	bl	_unixShmSystemLock
	mov	x21, x0
LBB0_8:
	mov	x0, x21
	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
	add	sp, sp, #96
	ret
LBB0_9:
	ldr	x1, [x24]
	ldr	w2, [x22]
	mov	x0, x19
	mov	w3, #1
	bl	_unixShmSystemLock
	mov	x21, x0
	ldr	w8, [x23]
	cmp	w0, w8
	b.ne	LBB0_6
; %bb.10:
	ldr	w0, [x20, #8]
	mov	w1, #3
	bl	_robust_ftruncate
	cbz	x0, LBB0_6
; %bb.11:
Lloh29:
	adrp	x8, _SQLITE_IOERR_SHMOPEN@GOTPAGE
Lloh30:
	ldr	x8, [x8, _SQLITE_IOERR_SHMOPEN@GOTPAGEOFF]
Lloh31:
	ldr	w0, [x8]
	ldr	w2, [x20, #4]
Lloh32:
	adrp	x1, l_.str@PAGE
Lloh33:
	add	x1, x1, l_.str@PAGEOFF
	bl	_unixLogError
	mov	x21, x0
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_SQLITE_OK,4,2                  ; @SQLITE_OK
	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
	.comm	_UNIX_SHM_DMS,4,2               ; @UNIX_SHM_DMS
	.comm	_F_WRLCK,8,3                    ; @F_WRLCK
	.comm	_F_GETLK,4,2                    ; @F_GETLK
	.comm	_SQLITE_IOERR_LOCK,4,2          ; @SQLITE_IOERR_LOCK
	.comm	_F_UNLCK,8,3                    ; @F_UNLCK
	.comm	_SQLITE_READONLY_CANTINIT,4,2   ; @SQLITE_READONLY_CANTINIT
	.comm	_SQLITE_IOERR_SHMOPEN,4,2       ; @SQLITE_IOERR_SHMOPEN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ftruncate"

	.comm	_SQLITE_BUSY,4,2                ; @SQLITE_BUSY
	.comm	_F_RDLCK,8,3                    ; @F_RDLCK
	.no_dead_strip	_unixLockSharedMemory
.subsections_via_symbols
