	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function idt_csr_read
_idt_csr_read:                          ## @idt_csr_read
	.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	%rdx, -80(%rbp)                 ## 8-byte Spill
	movl	%esi, %r13d
	movq	%rdi, %r15
	movq	32(%rdi), %r14
	movq	_CCODE_CSR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	(%rdi), %eax
	movl	%eax, -72(%rbp)
	leaq	-56(%rbp), %rax
	movq	%rax, -64(%rbp)
	leaq	24(%rdi), %r12
	movq	%r12, %rdi
	callq	_mutex_lock
	movq	_CSR_WRRD_CNT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -68(%rbp)
	movq	_CSR_OP_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	4(%r15), %eax
	movl	%eax, -56(%rbp)
	movl	%r13d, %edi
	callq	_cpu_to_le16
	movl	%eax, -48(%rbp)
	leaq	-72(%rbp), %rsi
	movq	%r15, %rdi
	callq	*8(%r15)
	testl	%eax, %eax
	je	LBB0_3
## %bb.1:
	movl	%eax, %ebx
	movl	%r13d, %edi
	callq	_CSR_REAL_ADDR
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_2
LBB0_3:
	movq	_CSR_RD_CNT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -68(%rbp)
	leaq	-72(%rbp), %rsi
	movq	%r15, %rdi
	callq	*16(%r15)
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %ebx
	movl	%r13d, %edi
	callq	_CSR_REAL_ADDR
	leaq	L_.str.1(%rip), %rsi
LBB0_2:
	movq	%r14, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_8:
	movq	%r12, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	_CSR_RERR@GOTPCREL(%rip), %rax
	movq	_CSR_WERR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	testl	%ecx, -56(%rbp)
	je	LBB0_7
## %bb.6:
	leaq	L_.str.2(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EREMOTEIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_7:
	movl	-52(%rbp), %edi
	callq	_le32_to_cpu
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	xorl	%ebx, %ebx
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_CCODE_CSR,4,2                  ## @CCODE_CSR
	.comm	_CSR_WRRD_CNT,4,2               ## @CSR_WRRD_CNT
	.comm	_CSR_OP_READ,4,2                ## @CSR_OP_READ
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to init csr address 0x%04x"

	.comm	_CSR_RD_CNT,4,2                 ## @CSR_RD_CNT
L_.str.1:                               ## @.str.1
	.asciz	"Failed to read csr 0x%04hx"

	.comm	_CSR_RERR,4,2                   ## @CSR_RERR
	.comm	_CSR_WERR,4,2                   ## @CSR_WERR
L_.str.2:                               ## @.str.2
	.asciz	"IDT failed to perform CSR r/w"

	.comm	_EREMOTEIO,4,2                  ## @EREMOTEIO
	.no_dead_strip	_idt_csr_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function idt_csr_read
_idt_csr_read:                          ; @idt_csr_read
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x21, x2
	mov	x22, x1
	mov	x24, x0
	ldr	x20, [x0, #32]
	ldr	w8, [x0]
Lloh0:
	adrp	x9, _CCODE_CSR@GOTPAGE
Lloh1:
	ldr	x9, [x9, _CCODE_CSR@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [sp, #16]
	add	x8, sp, #32
	str	x8, [sp, #24]
	add	x19, x0, #24
	mov	x0, x19
	bl	_mutex_lock
Lloh3:
	adrp	x8, _CSR_WRRD_CNT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _CSR_WRRD_CNT@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	str	w8, [sp, #20]
	ldr	w8, [x24, #4]
Lloh6:
	adrp	x9, _CSR_OP_READ@GOTPAGE
Lloh7:
	ldr	x9, [x9, _CSR_OP_READ@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [sp, #32]
	mov	x0, x22
	bl	_cpu_to_le16
	str	w0, [sp, #40]
	ldr	x8, [x24, #8]
	add	x1, sp, #16
	mov	x0, x24
	blr	x8
	cbz	w0, LBB0_2
; %bb.1:
	mov	x23, x0
	mov	x0, x22
	bl	_CSR_REAL_ADDR
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_4
LBB0_2:
Lloh11:
	adrp	x8, _CSR_RD_CNT@GOTPAGE
Lloh12:
	ldr	x8, [x8, _CSR_RD_CNT@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	str	w8, [sp, #20]
	ldr	x8, [x24, #16]
	add	x1, sp, #16
	mov	x0, x24
	blr	x8
	cbz	w0, LBB0_6
; %bb.3:
	mov	x23, x0
	mov	x0, x22
	bl	_CSR_REAL_ADDR
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_4:
	mov	x0, x20
	bl	_dev_err
LBB0_5:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x23
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_6:
	ldr	w8, [sp, #32]
Lloh16:
	adrp	x9, _CSR_RERR@GOTPAGE
Lloh17:
	ldr	x9, [x9, _CSR_RERR@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
Lloh19:
	adrp	x10, _CSR_WERR@GOTPAGE
Lloh20:
	ldr	x10, [x10, _CSR_WERR@GOTPAGEOFF]
Lloh21:
	ldr	w10, [x10]
	orr	w9, w10, w9
	tst	w9, w8
	b.eq	LBB0_8
; %bb.7:
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_dev_err
Lloh24:
	adrp	x8, _EREMOTEIO@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EREMOTEIO@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_5
LBB0_8:
	ldr	w0, [sp, #36]
	bl	_le32_to_cpu
	mov	w23, #0
	str	w0, [x21]
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_CCODE_CSR,4,2                  ; @CCODE_CSR
	.comm	_CSR_WRRD_CNT,4,2               ; @CSR_WRRD_CNT
	.comm	_CSR_OP_READ,4,2                ; @CSR_OP_READ
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to init csr address 0x%04x"

	.comm	_CSR_RD_CNT,4,2                 ; @CSR_RD_CNT
l_.str.1:                               ; @.str.1
	.asciz	"Failed to read csr 0x%04hx"

	.comm	_CSR_RERR,4,2                   ; @CSR_RERR
	.comm	_CSR_WERR,4,2                   ; @CSR_WERR
l_.str.2:                               ; @.str.2
	.asciz	"IDT failed to perform CSR r/w"

	.comm	_EREMOTEIO,4,2                  ; @EREMOTEIO
	.no_dead_strip	_idt_csr_read
.subsections_via_symbols
