	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stm_unlock
_stm_unlock:                            ## @stm_unlock
	.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	_SR_BP2@GOTPCREL(%rip), %rax
	movq	_SR_BP1@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	orl	(%rax), %ebx
	movq	%rdx, %r13
	movq	%rsi, %r14
	movq	%rdi, %r12
	movq	_SR_BP0@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	bsfl	%ebx, %eax
	movl	$-1, %ecx
	cmovnel	%eax, %ecx
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movq	_SNOR_F_HAS_SR_TB@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	andl	(%rdi), %r15d
	callq	_read_sr
	testl	%eax, %eax
	js	LBB0_5
## %bb.1:
	movq	%r12, %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	movl	%eax, %ecx
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	callq	_stm_is_unlocked_sr
	movq	%rax, %rcx
	xorl	%eax, %eax
	testq	%rcx, %rcx
	jne	LBB0_5
## %bb.2:
	movq	%r12, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	callq	_stm_is_unlocked_sr
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	addq	%r14, %r13
	movq	8(%r12), %rdx
	subq	%r13, %rdx
	movq	%r12, %rdi
	movq	%r13, %rsi
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	callq	_stm_is_unlocked_sr
	testq	%rax, %rax
	setne	%al
	testl	%r15d, %r15d
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	setne	%cl
	testb	%cl, %al
	jne	LBB0_6
## %bb.3:
	testq	%r15, %r15
	je	LBB0_4
LBB0_6:
	movq	8(%r12), %rdi
	movq	%rdi, %r14
	subq	%r13, %r14
	testq	%r15, %r15
	cmoveq	-56(%rbp), %r14                 ## 8-byte Folded Reload
	callq	_ilog2
	movl	%eax, %r13d
	movq	%r14, %rdi
	callq	_order_base_2
	testq	%r14, %r14
	movl	$0, %edx
	je	LBB0_8
## %bb.7:
	subl	%r13d, %eax
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	addl	%ebx, %eax
	movl	%ebx, %ecx
	notl	%ecx
	movl	%eax, %edx
	testl	%ecx, %eax
	jne	LBB0_4
LBB0_8:
	movq	_SR_TB@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%esi, %ecx
	orl	%ebx, %ecx
	notl	%ecx
	movl	-44(%rbp), %r8d                 ## 4-byte Reload
	andl	%r8d, %ecx
	orl	%edx, %ecx
	movq	_SR_SRWD@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%eax, %eax
	negq	%r14
	movl	$0, %edi
	sbbl	%edi, %edi
	notl	%edx
	orl	%edx, %edi
	andl	%ecx, %edi
	testq	%r15, %r15
	cmovnel	%eax, %esi
	orl	%edi, %esi
	cmpl	%r8d, %esi
	je	LBB0_5
## %bb.9:
	movl	%esi, %eax
	andl	%ebx, %eax
	andl	%ebx, %r8d
	cmpl	%r8d, %eax
	jle	LBB0_10
LBB0_4:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_5:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movq	%r12, %rdi
	movl	%ebx, %edx
	addq	$24, %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_unlock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stm_unlock
_stm_unlock:                            ; @stm_unlock
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x24, 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	w25, w8, wzr, ne
	ldr	w23, [x0]
Lloh9:
	adrp	x8, _SNOR_F_HAS_SR_TB@GOTPAGE
Lloh10:
	ldr	x8, [x8, _SNOR_F_HAS_SR_TB@GOTPAGEOFF]
Lloh11:
	ldr	w26, [x8]
	bl	_read_sr
	mov	x21, x0
	tbnz	w0, #31, LBB0_3
; %bb.1:
	mov	x0, x19
	mov	x1, x22
	mov	x2, x24
	mov	x3, x21
	bl	_stm_is_unlocked_sr
	cbz	x0, LBB0_4
; %bb.2:
	mov	w0, #0
	b	LBB0_11
LBB0_3:
	mov	x0, x21
	b	LBB0_11
LBB0_4:
	and	w26, w26, w23
	mov	x0, x19
	mov	x1, #0
	mov	x2, x22
	mov	x3, x21
	bl	_stm_is_unlocked_sr
	mov	x23, x0
	ldr	x8, [x19, #8]
	add	x24, x24, x22
	sub	x2, x8, x24
	mov	x0, x19
	mov	x1, x24
	mov	x3, x21
	bl	_stm_is_unlocked_sr
	cmp	w26, #0
	ccmp	x0, #0, #4, ne
	ccmp	x23, #0, #0, eq
	b.eq	LBB0_10
; %bb.5:
	ldr	x0, [x19, #8]
	sub	x8, x0, x24
	cmp	x23, #0
	csel	x22, x22, x8, eq
	bl	_ilog2
	mov	x24, x0
	mov	x0, x22
	bl	_order_base_2
	cbz	x22, LBB0_7
; %bb.6:
	sub	w8, w0, w24
	lsl	w8, w8, w25
	add	w8, w8, w20
	bics	wzr, w8, w20
	b.ne	LBB0_10
	b	LBB0_8
LBB0_7:
	mov	w8, #0
LBB0_8:
	mov	w0, #0
Lloh12:
	adrp	x9, _SR_TB@GOTPAGE
Lloh13:
	ldr	x9, [x9, _SR_TB@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w10, w9, w20
	bic	w10, w21, w10
	orr	w8, w10, w8
Lloh15:
	adrp	x10, _SR_SRWD@GOTPAGE
Lloh16:
	ldr	x10, [x10, _SR_SRWD@GOTPAGEOFF]
Lloh17:
	ldr	w10, [x10]
	cmp	x22, #0
	mov	w11, #-1
	csinv	w10, w11, w10, ne
	and	w8, w8, w10
	cmp	x23, #0
	csel	w9, w9, wzr, eq
	orr	w1, w8, w9
	cmp	w1, w21
	b.eq	LBB0_11
; %bb.9:
	and	w8, w1, w20
	and	w9, w21, w20
	cmp	w8, w9
	b.le	LBB0_12
LBB0_10:
Lloh18:
	adrp	x8, _EINVAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_11:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_12:
	mov	x0, x19
	mov	x2, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 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	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.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_unlock
.subsections_via_symbols
