	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function drxj_dap_atomic_read_write_block
_drxj_dap_atomic_read_write_block:      ## @drxj_dap_atomic_read_write_block
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	$0, -68(%rbp)
	testb	$1, %dl
	jne	LBB0_4
## %bb.1:
	movq	%rdi, %r14
	testq	%rdi, %rdi
	je	LBB0_4
## %bb.2:
	movq	%rcx, %r12
	testq	%rcx, %rcx
	je	LBB0_4
## %bb.3:
	cmpl	$18, %edx
	jl	LBB0_5
LBB0_4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_20:
	movl	%ebx, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	%rsi, %r13
	movl	%edx, %r15d
	shrl	$31, %r15d
	movl	%edx, -48(%rbp)                 ## 4-byte Spill
	addl	%edx, %r15d
	sarl	%r15d
	movq	_SIO_HI_RA_RAM_CMD_ATOMIC_COPY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -92(%rbp)
	movq	_DRXJ_HI_ATOMIC_BUF_START@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movl	%r8d, -44(%rbp)                 ## 4-byte Spill
	callq	_DRXDAP_FASI_ADDR2BLOCK
	movl	%eax, %ebx
	shll	$6, %ebx
	movq	_DRXJ_HI_ATOMIC_BUF_START@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	callq	_DRXDAP_FASI_ADDR2BANK
	addl	%ebx, %eax
	movl	%eax, -112(%rbp)
	movq	_DRXJ_HI_ATOMIC_BUF_START@GOTPCREL(%rip), %rax
	movq	%rax, %rbx
	movq	(%rax), %rdi
	callq	_DRXDAP_FASI_ADDR2OFFSET
	movl	%eax, -108(%rbp)
	movq	%r15, -88(%rbp)                 ## 8-byte Spill
	leal	-1(%r15), %eax
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_6
## %bb.7:
	movq	_DRXJ_HI_ATOMIC_WRITE@GOTPCREL(%rip), %rcx
	jmp	LBB0_8
LBB0_6:
	movq	_DRXJ_HI_ATOMIC_READ@GOTPCREL(%rip), %rcx
LBB0_8:
	movq	%rbx, %r15
	orl	(%rcx), %eax
	movl	%eax, -104(%rbp)
	movq	%r13, %rdi
	callq	_DRXDAP_FASI_ADDR2BLOCK
	movl	%eax, %ebx
	shll	$6, %ebx
	movq	%r13, %rdi
	callq	_DRXDAP_FASI_ADDR2BANK
	addl	%ebx, %eax
	movl	%eax, -100(%rbp)
	movq	%r13, %rdi
	callq	_DRXDAP_FASI_ADDR2OFFSET
	movl	%eax, -96(%rbp)
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_13
## %bb.9:
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
                                        ## implicit-def: $ebx
	cmpl	$2, -48(%rbp)                   ## 4-byte Folded Reload
	movq	%r14, %r12
	movq	%r15, %r13
	jl	LBB0_12
## %bb.10:
	movl	-88(%rbp), %ecx                 ## 4-byte Reload
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	leaq	8(%rcx), %r15
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r15), %ebx
	shll	$8, %ebx
	addl	-8(%r15), %ebx
	movq	(%r13), %rsi
	addq	%r14, %rsi
	movq	%r12, %rdi
	movl	%ebx, %edx
	xorl	%ecx, %ecx
	callq	_drxj_dap_write_reg16
	incq	%r14
	addq	$16, %r15
	cmpq	%r14, -64(%rbp)                 ## 8-byte Folded Reload
	jne	LBB0_11
LBB0_12:
	movl	%ebx, -52(%rbp)
	movq	%r12, %r14
	movq	%r13, %r15
	movq	-80(%rbp), %r12                 ## 8-byte Reload
LBB0_13:
	leaq	-112(%rbp), %rsi
	leaq	-68(%rbp), %rdx
	movq	%r14, %rdi
	callq	_hi_command
	testl	%eax, %eax
	je	LBB0_15
LBB0_14:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	callq	_pr_err
	jmp	LBB0_20
LBB0_15:
	xorl	%ebx, %ebx
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_20
## %bb.16:
	cmpl	$2, -48(%rbp)                   ## 4-byte Folded Reload
	jl	LBB0_20
## %bb.17:
	movq	%r15, %r13
	movl	-88(%rbp), %eax                 ## 4-byte Reload
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	addq	$8, %r12
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_18:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r13), %rsi
	addq	%r15, %rsi
	movq	%r14, %rdi
	leaq	-52(%rbp), %rdx
	xorl	%ecx, %ecx
	callq	_drxj_dap_read_reg16
	testl	%eax, %eax
	jne	LBB0_14
## %bb.19:                              ##   in Loop: Header=BB0_18 Depth=1
	movl	-52(%rbp), %eax
	movzbl	%al, %ecx
	movq	%rcx, -8(%r12)
	sarl	$8, %eax
	cltq
	movq	%rax, (%r12)
	incq	%r15
	addq	$16, %r12
	xorl	%ebx, %ebx
	cmpq	%r15, -64(%rbp)                 ## 8-byte Folded Reload
	jne	LBB0_18
	jmp	LBB0_20
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SIO_HI_RA_RAM_CMD_ATOMIC_COPY,4,2 ## @SIO_HI_RA_RAM_CMD_ATOMIC_COPY
	.comm	_DRXJ_HI_ATOMIC_BUF_START,8,3   ## @DRXJ_HI_ATOMIC_BUF_START
	.comm	_DRXJ_HI_ATOMIC_WRITE,4,2       ## @DRXJ_HI_ATOMIC_WRITE
	.comm	_DRXJ_HI_ATOMIC_READ,4,2        ## @DRXJ_HI_ATOMIC_READ
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"error %d\n"

	.no_dead_strip	_drxj_dap_atomic_read_write_block
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function drxj_dap_atomic_read_write_block
_drxj_dap_atomic_read_write_block:      ; @drxj_dap_atomic_read_write_block
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	str	wzr, [sp]
	tbnz	w2, #0, LBB0_4
; %bb.1:
	mov	x19, x0
	cbz	x0, LBB0_4
; %bb.2:
	mov	x20, x3
	cbz	x3, LBB0_4
; %bb.3:
	mov	x21, x2
	cmp	w2, #0
	cinc	w8, w2, lt
	cmp	w2, #18
	b.lt	LBB0_6
LBB0_4:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_5:
	mov	x0, x23
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_6:
	mov	x22, x4
	mov	x23, x1
Lloh3:
	adrp	x9, _SIO_HI_RA_RAM_CMD_ATOMIC_COPY@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SIO_HI_RA_RAM_CMD_ATOMIC_COPY@GOTPAGEOFF]
	asr	w25, w8, #1
Lloh5:
	ldr	w8, [x9]
	str	w8, [sp, #28]
Lloh6:
	adrp	x26, _DRXJ_HI_ATOMIC_BUF_START@GOTPAGE
Lloh7:
	ldr	x26, [x26, _DRXJ_HI_ATOMIC_BUF_START@GOTPAGEOFF]
	ldr	x0, [x26]
	bl	_DRXDAP_FASI_ADDR2BLOCK
	mov	x24, x0
	ldr	x0, [x26]
	bl	_DRXDAP_FASI_ADDR2BANK
	add	w8, w0, w24, lsl #6
	str	w8, [sp, #8]
	ldr	x0, [x26]
	bl	_DRXDAP_FASI_ADDR2OFFSET
	str	w0, [sp, #12]
Lloh8:
	adrp	x8, _DRXJ_HI_ATOMIC_WRITE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _DRXJ_HI_ATOMIC_WRITE@GOTPAGEOFF]
Lloh10:
	adrp	x9, _DRXJ_HI_ATOMIC_READ@GOTPAGE
Lloh11:
	ldr	x9, [x9, _DRXJ_HI_ATOMIC_READ@GOTPAGEOFF]
	sub	w10, w25, #1
	cmp	w22, #0
	csel	x8, x8, x9, eq
	ldr	w8, [x8]
	orr	w8, w8, w10
	str	w8, [sp, #16]
	mov	x0, x23
	bl	_DRXDAP_FASI_ADDR2BLOCK
	mov	x24, x0
	mov	x0, x23
	bl	_DRXDAP_FASI_ADDR2BANK
	add	w8, w0, w24, lsl #6
	str	w8, [sp, #20]
	mov	x0, x23
	bl	_DRXDAP_FASI_ADDR2OFFSET
	str	w0, [sp, #24]
	cbnz	w22, LBB0_11
; %bb.7:
                                        ; implicit-def: $w23
	cmp	w21, #2
	b.lt	LBB0_10
; %bb.8:
	mov	x24, #0
	add	x27, x20, #8
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldur	w8, [x27, #-8]
	ldr	w9, [x27], #16
	add	w23, w8, w9, lsl #8
	ldr	x8, [x26]
	add	x1, x24, x8
	mov	x0, x19
	mov	x2, x23
	mov	w3, #0
	bl	_drxj_dap_write_reg16
	add	x24, x24, #1
	cmp	x25, x24
	b.ne	LBB0_9
LBB0_10:
	str	w23, [sp, #4]
LBB0_11:
	add	x1, sp, #8
	mov	x2, sp
	mov	x0, x19
	bl	_hi_command
	mov	x23, x0
	cbz	w0, LBB0_13
LBB0_12:
Lloh12:
	adrp	x0, l_.str@PAGE
Lloh13:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x23
	bl	_pr_err
	b	LBB0_5
LBB0_13:
	cbz	w22, LBB0_5
; %bb.14:
	cmp	w21, #2
	b.lt	LBB0_5
; %bb.15:
	mov	x21, #0
	add	x20, x20, #8
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x26]
	add	x1, x21, x8
	add	x2, sp, #4
	mov	x0, x19
	mov	w3, #0
	bl	_drxj_dap_read_reg16
	mov	x23, x0
	cbnz	w0, LBB0_12
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=1
	ldr	w8, [sp, #4]
	and	x9, x8, #0xff
                                        ; kill: def $w8 killed $w8 killed $x8 def $x8
	sbfx	x8, x8, #8, #24
	stp	x9, x8, [x20, #-8]
	add	x21, x21, #1
	add	x20, x20, #16
	cmp	x25, x21
	b.ne	LBB0_16
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SIO_HI_RA_RAM_CMD_ATOMIC_COPY,4,2 ; @SIO_HI_RA_RAM_CMD_ATOMIC_COPY
	.comm	_DRXJ_HI_ATOMIC_BUF_START,8,3   ; @DRXJ_HI_ATOMIC_BUF_START
	.comm	_DRXJ_HI_ATOMIC_WRITE,4,2       ; @DRXJ_HI_ATOMIC_WRITE
	.comm	_DRXJ_HI_ATOMIC_READ,4,2        ; @DRXJ_HI_ATOMIC_READ
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"error %d\n"

	.no_dead_strip	_drxj_dap_atomic_read_write_block
.subsections_via_symbols
