	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_acquire_hw_mutex               ## -- Begin function acquire_hw_mutex
	.p2align	4, 0x90
_acquire_hw_mutex:                      ## @acquire_hw_mutex
	.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	%rdi, %r14
	movb	(%rdi), %cl
	movl	$1, %ebx
	shll	%cl, %ebx
	movslq	%ebx, %r15
	movq	_ASIC_CFG_MUTEX@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	callq	_read_csr
	cmpq	%r15, %rax
	jne	LBB0_1
## %bb.4:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_dd_dev_info
LBB0_12:
	xorl	%eax, %eax
	jmp	LBB0_13
LBB0_1:
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movq	_HM_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msecs_to_jiffies
	movq	%rax, %r13
	movq	_jiffies@GOTPCREL(%rip), %rbx
	addq	(%rbx), %r13
	movl	(%r12), %esi
	movq	%r14, %rdi
	movq	%r15, %rdx
	callq	_write_csr
	movl	(%r12), %esi
	movq	%r14, %rdi
	callq	_read_csr
	movq	%rax, %r12
	xorl	%eax, %eax
	cmpq	%r15, %r12
	je	LBB0_13
## %bb.2:
	movq	(%rbx), %rdi
	movq	%r13, %rsi
	callq	_time_after
	testq	%rax, %rax
	jne	LBB0_7
## %bb.3:
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %r13
	movl	$20, %edi
	callq	_msleep
	movq	_ASIC_CFG_MUTEX@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r14, %rdi
	movq	%r15, %rdx
	callq	_write_csr
	movl	(%rbx), %esi
	movq	%r14, %rdi
	callq	_read_csr
	cmpq	%r15, %rax
	je	LBB0_12
## %bb.5:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%rax, %r12
	movq	%r13, %rbx
	movq	(%r13), %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_time_after
	testq	%rax, %rax
	je	LBB0_6
LBB0_7:
	leaq	L_.str.1(%rip), %rsi
	leaq	L_.str.2(%rip), %r8
	movq	%r14, %rdi
	movl	%r12d, %edx
	movl	%r15d, %ecx
	callq	_dd_dev_err
	movq	_ASIC_CFG_MUTEX@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_write_csr
	movq	_HM_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msecs_to_jiffies
	movq	%rax, %r13
	addq	(%rbx), %r13
	movl	(%r12), %esi
	movq	%r14, %rdi
	movq	%r15, %rdx
	callq	_write_csr
	movl	(%r12), %esi
	movq	%r14, %rdi
	callq	_read_csr
	cmpq	%r15, %rax
	je	LBB0_12
## %bb.8:
	movq	%rbx, %r12
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rax, %rbx
	movq	(%r12), %rdi
	movq	%r13, %rsi
	callq	_time_after
	testq	%rax, %rax
	jne	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	$20, %edi
	callq	_msleep
	movq	_ASIC_CFG_MUTEX@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r14, %rdi
	movq	%r15, %rdx
	callq	_write_csr
	movl	(%rbx), %esi
	movq	%r14, %rdi
	callq	_read_csr
	cmpq	%r15, %rax
	jne	LBB0_9
	jmp	LBB0_12
LBB0_10:
	leaq	L_.str.1(%rip), %rsi
	leaq	L_.str.3(%rip), %r8
	movq	%r14, %rdi
	movl	%ebx, %edx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	callq	_dd_dev_err
	movq	_EBUSY@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_13:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ASIC_CFG_MUTEX,4,2             ## @ASIC_CFG_MUTEX
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Hardware mutex already acquired, mutex mask %u\n"

	.comm	_HM_TIMEOUT,4,2                 ## @HM_TIMEOUT
	.comm	_jiffies,8,3                    ## @jiffies
L_.str.1:                               ## @.str.1
	.asciz	"Unable to acquire hardware mutex, mutex mask %u, my mask %u (%s)\n"

L_.str.2:                               ## @.str.2
	.asciz	"retrying"

L_.str.3:                               ## @.str.3
	.asciz	"giving up"

	.comm	_EBUSY,4,2                      ## @EBUSY
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_acquire_hw_mutex               ; -- Begin function acquire_hw_mutex
	.p2align	2
_acquire_hw_mutex:                      ; @acquire_hw_mutex
	.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	x19, x0
	ldr	w8, [x0]
	mov	w9, #1
	lsl	w8, w9, w8
	sxtw	x20, w8
Lloh0:
	adrp	x23, _ASIC_CFG_MUTEX@GOTPAGE
Lloh1:
	ldr	x23, [x23, _ASIC_CFG_MUTEX@GOTPAGEOFF]
	ldr	w1, [x23]
	bl	_read_csr
	cmp	x0, x20
	b.ne	LBB0_2
; %bb.1:
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, x20
	bl	_dd_dev_info
	b	LBB0_8
LBB0_2:
Lloh4:
	adrp	x25, _HM_TIMEOUT@GOTPAGE
Lloh5:
	ldr	x25, [x25, _HM_TIMEOUT@GOTPAGEOFF]
	ldr	w0, [x25]
	bl	_msecs_to_jiffies
	mov	x21, x0
Lloh6:
	adrp	x24, _jiffies@GOTPAGE
Lloh7:
	ldr	x24, [x24, _jiffies@GOTPAGEOFF]
	ldr	x26, [x24]
	ldr	w1, [x23]
	mov	x0, x19
	mov	x2, x20
	bl	_write_csr
	ldr	w1, [x23]
	mov	x0, x19
	bl	_read_csr
	cmp	x0, x20
	b.eq	LBB0_8
; %bb.3:
	mov	x22, x0
	add	x21, x26, x21
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x24]
	mov	x1, x21
	bl	_time_after
	cbnz	x0, LBB0_7
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w0, #20
	bl	_msleep
	ldr	w1, [x23]
	mov	x0, x19
	mov	x2, x20
	bl	_write_csr
	ldr	w1, [x23]
	mov	x0, x19
	bl	_read_csr
	cmp	x0, x20
	b.eq	LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x22, x0
	b	LBB0_4
LBB0_7:
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
Lloh10:
	adrp	x4, l_.str.2@PAGE
Lloh11:
	add	x4, x4, l_.str.2@PAGEOFF
	mov	x0, x19
	mov	x2, x22
	mov	x3, x20
	bl	_dd_dev_err
	ldr	w1, [x23]
	mov	x0, x19
	mov	x2, #0
	bl	_write_csr
	ldr	w0, [x25]
	bl	_msecs_to_jiffies
	mov	x21, x0
	ldr	x25, [x24]
	ldr	w1, [x23]
	mov	x0, x19
	mov	x2, x20
	bl	_write_csr
	ldr	w1, [x23]
	mov	x0, x19
	bl	_read_csr
	cmp	x0, x20
	b.ne	LBB0_10
LBB0_8:
	mov	w0, #0
LBB0_9:
	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_10:
	mov	x22, x0
	add	x21, x25, x21
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x24]
	mov	x1, x21
	bl	_time_after
	cbnz	x0, LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	w0, #20
	bl	_msleep
	ldr	w1, [x23]
	mov	x0, x19
	mov	x2, x20
	bl	_write_csr
	ldr	w1, [x23]
	mov	x0, x19
	bl	_read_csr
	cmp	x0, x20
	b.eq	LBB0_8
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x22, x0
	b	LBB0_11
LBB0_14:
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
Lloh14:
	adrp	x4, l_.str.3@PAGE
Lloh15:
	add	x4, x4, l_.str.3@PAGEOFF
	mov	x0, x19
	mov	x2, x22
	mov	x3, x20
	bl	_dd_dev_err
Lloh16:
	adrp	x8, _EBUSY@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_ASIC_CFG_MUTEX,4,2             ; @ASIC_CFG_MUTEX
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Hardware mutex already acquired, mutex mask %u\n"

	.comm	_HM_TIMEOUT,4,2                 ; @HM_TIMEOUT
	.comm	_jiffies,8,3                    ; @jiffies
l_.str.1:                               ; @.str.1
	.asciz	"Unable to acquire hardware mutex, mutex mask %u, my mask %u (%s)\n"

l_.str.2:                               ; @.str.2
	.asciz	"retrying"

l_.str.3:                               ; @.str.3
	.asciz	"giving up"

	.comm	_EBUSY,4,2                      ; @EBUSY
.subsections_via_symbols
