	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stm_lock
_stm_lock:                              ## @stm_lock
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_SR_BP2@GOTPCREL(%rip), %rax
	movq	_SR_BP1@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r13d
	orl	(%rax), %r13d
	movq	%rdx, %r14
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r12
	movq	_SR_BP0@GOTPCREL(%rip), %rax
	orl	(%rax), %r13d
	bsfl	%r13d, %eax
	movl	$-1, %ebx
	cmovnel	%eax, %ebx
	movq	_SNOR_F_HAS_SR_TB@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	andl	(%rdi), %r15d
	callq	_read_sr
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movl	%ebx, -64(%rbp)                 ## 4-byte Spill
	movq	%r12, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	%r14, %rdx
	movl	%eax, %ebx
	movl	%eax, %ecx
	callq	_stm_is_locked_sr
	xorl	%ecx, %ecx
	testq	%rax, %rax
	jne	LBB0_6
## %bb.3:
	movq	%r12, %rdi
	xorl	%esi, %esi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movl	%ebx, %ecx
	callq	_stm_is_locked_sr
	testq	%rax, %rax
	setne	-41(%rbp)                       ## 1-byte Folded Spill
	addq	-56(%rbp), %r14                 ## 8-byte Folded Reload
	movq	8(%r12), %rdx
	subq	%r14, %rdx
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	movq	%r12, %rdi
	movq	%r14, -80(%rbp)                 ## 8-byte Spill
	movq	%r14, %rsi
	movl	%ebx, -60(%rbp)                 ## 4-byte Spill
	movl	%ebx, %ecx
	callq	_stm_is_locked_sr
	movq	%rax, %r14
	testl	%r15d, %r15d
	setne	%al
	testb	%al, -41(%rbp)                  ## 1-byte Folded Reload
	jne	LBB0_7
## %bb.4:
	testq	%r14, %r14
	je	LBB0_5
LBB0_7:
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rdi
	movq	%rdi, %rbx
	subq	-56(%rbp), %rbx                 ## 8-byte Folded Reload
	testq	%r14, %r14
	cmoveq	-80(%rbp), %rbx                 ## 8-byte Folded Reload
	callq	_ilog2
	movl	%eax, %r15d
	movq	%rbx, %rdi
	callq	_ilog2
	subl	%r15d, %eax
	movl	-64(%rbp), %ecx                 ## 4-byte Reload
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	addl	%r13d, %eax
	movl	%r13d, %ecx
	notl	%ecx
	testl	%ecx, %eax
	je	LBB0_8
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	subl	(%rax), %ecx
	jmp	LBB0_6
LBB0_1:
	movl	%eax, %ecx
LBB0_6:
	movl	%ecx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	testl	%r13d, %eax
	je	LBB0_5
## %bb.9:
	movq	_SR_TB@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	%edx, %esi
	orl	%r13d, %esi
	notl	%esi
	movl	-60(%rbp), %edi                 ## 4-byte Reload
	andl	%edi, %esi
	xorl	%ecx, %ecx
	testq	%r14, %r14
	movq	_SR_SRWD@GOTPCREL(%rip), %r8
	cmovnel	%ecx, %edx
	orl	(%r8), %eax
	orl	%edx, %eax
	orl	%eax, %esi
	cmpl	%edi, %esi
	je	LBB0_6
## %bb.10:
	andl	%r13d, %eax
	andl	%r13d, %edi
	cmpl	%edi, %eax
	jl	LBB0_5
## %bb.11:
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movl	%r13d, %edx
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_write_sr_and_check             ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_SR_BP2,4,2                     ## @SR_BP2
	.comm	_SR_BP1,4,2                     ## @SR_BP1
	.comm	_SR_BP0,4,2                     ## @SR_BP0
	.comm	_SNOR_F_HAS_SR_TB,4,2           ## @SNOR_F_HAS_SR_TB
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SR_TB,4,2                      ## @SR_TB
	.comm	_SR_SRWD,4,2                    ## @SR_SRWD
	.no_dead_strip	_stm_lock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stm_lock
_stm_lock:                              ; @stm_lock
	.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	x23, x2
	mov	x22, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _SR_BP2@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SR_BP2@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _SR_BP1@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SR_BP1@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh6:
	adrp	x9, _SR_BP0@GOTPAGE
Lloh7:
	ldr	x9, [x9, _SR_BP0@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w20, w8, w9
	rbit	w8, w20
	clz	w8, w8
	cmp	w20, #0
	csinv	w26, w8, wzr, ne
	ldr	w24, [x0]
Lloh9:
	adrp	x8, _SNOR_F_HAS_SR_TB@GOTPAGE
Lloh10:
	ldr	x8, [x8, _SNOR_F_HAS_SR_TB@GOTPAGEOFF]
Lloh11:
	ldr	w25, [x8]
	bl	_read_sr
	mov	x21, x0
	tbnz	w0, #31, LBB0_3
; %bb.1:
	mov	x0, x19
	mov	x1, x22
	mov	x2, x23
	mov	x3, x21
	bl	_stm_is_locked_sr
	cbz	x0, LBB0_4
; %bb.2:
	mov	w0, #0
	b	LBB0_7
LBB0_3:
	mov	x0, x21
	b	LBB0_7
LBB0_4:
	and	w27, w25, w24
	mov	x0, x19
	mov	x1, #0
	mov	x2, x22
	mov	x3, x21
	bl	_stm_is_locked_sr
	mov	x25, x0
	ldr	x8, [x19, #8]
	add	x24, x23, x22
	sub	x2, x8, x24
	mov	x0, x19
	mov	x1, x24
	mov	x3, x21
	bl	_stm_is_locked_sr
	cmp	w27, #0
	ccmp	x25, #0, #4, ne
	ccmp	x0, #0, #0, eq
	b.eq	LBB0_6
; %bb.5:
	mov	x23, x0
	ldr	x0, [x19, #8]
	sub	x8, x0, x22
	cmp	x23, #0
	csel	x22, x24, x8, eq
	bl	_ilog2
	mov	x24, x0
	mov	x0, x22
	bl	_ilog2
	sub	w8, w0, w24
	lsl	w8, w8, w26
	add	w8, w8, w20
	bics	wzr, w8, w20
	b.eq	LBB0_8
LBB0_6:
Lloh12:
	adrp	x8, _EINVAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_7:
	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_8:
	tst	w8, w20
	b.eq	LBB0_6
; %bb.9:
	mov	w0, #0
Lloh15:
	adrp	x9, _SR_TB@GOTPAGE
Lloh16:
	ldr	x9, [x9, _SR_TB@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	orr	w10, w9, w20
	bic	w10, w21, w10
Lloh18:
	adrp	x11, _SR_SRWD@GOTPAGE
Lloh19:
	ldr	x11, [x11, _SR_SRWD@GOTPAGEOFF]
Lloh20:
	ldr	w11, [x11]
	cmp	x23, #0
	csel	w9, w9, wzr, eq
	orr	w8, w11, w8
	orr	w8, w8, w9
	orr	w1, w8, w10
	cmp	w1, w21
	b.eq	LBB0_7
; %bb.10:
	and	w8, w8, w20
	and	w9, w21, w20
	cmp	w8, w9
	b.lt	LBB0_6
; %bb.11:
	mov	x0, x19
	mov	x2, x20
	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
	b	_write_sr_and_check
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_SR_BP2,4,2                     ; @SR_BP2
	.comm	_SR_BP1,4,2                     ; @SR_BP1
	.comm	_SR_BP0,4,2                     ; @SR_BP0
	.comm	_SNOR_F_HAS_SR_TB,4,2           ; @SNOR_F_HAS_SR_TB
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SR_TB,4,2                      ; @SR_TB
	.comm	_SR_SRWD,4,2                    ; @SR_SRWD
	.no_dead_strip	_stm_lock
.subsections_via_symbols
