	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mga_do_dma_wrap_start          ## -- Begin function mga_do_dma_wrap_start
	.p2align	4, 0x90
_mga_do_dma_wrap_start:                 ## @mga_do_dma_wrap_start
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	xorl	%eax, %eax
	callq	_BEGIN_DMA_WRAP
	movq	_MGA_DMAPAD@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	xorl	%esi, %esi
	movl	%edi, %edx
	xorl	%ecx, %ecx
	movl	%edi, %r8d
	xorl	%r9d, %r9d
	pushq	$0
	pushq	%rdi
	callq	_DMA_BLOCK
	addq	$16, %rsp
	xorl	%eax, %eax
	callq	_ADVANCE_DMA
	movslq	36(%rbx), %r12
	movq	8(%rbx), %rax
	movq	(%rax), %r14
	movl	$0, 36(%rbx)
	movq	$0, 48(%rbx)
	incl	32(%rbx)
	movq	_MGA_PRIMADDRESS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_MGA_READ
	movq	8(%rbx), %rcx
	subq	(%rcx), %rax
	jne	LBB0_2
## %bb.1:
	movq	40(%rbx), %rcx
	jmp	LBB0_3
LBB0_2:
	movq	%rax, %rcx
LBB0_3:
	leaq	16(%rbx), %r15
	movq	%rcx, 24(%rbx)
	addq	%r12, %r14
	leaq	L_.str.1(%rip), %rdi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	movl	36(%rbx), %esi
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	movl	32(%rbx), %esi
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	movq	24(%rbx), %rsi
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	xorl	%eax, %eax
	callq	_mga_flush_write_combine
	movq	_MGA_PRIMEND@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	orq	(%rbx), %r14
	movq	%r14, %rsi
	callq	_MGA_WRITE
	xorl	%edi, %edi
	movq	%r15, %rsi
	callq	_set_bit
	leaq	L_.str.5(%rip), %rdi
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_DRM_DEBUG                      ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_LOCALS,4,2                 ## @DMA_LOCALS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"\n"

	.comm	_MGA_DMAPAD,4,2                 ## @MGA_DMAPAD
	.comm	_MGA_PRIMADDRESS,4,2            ## @MGA_PRIMADDRESS
L_.str.1:                               ## @.str.1
	.asciz	"   head = 0x%06lx\n"

L_.str.2:                               ## @.str.2
	.asciz	"   tail = 0x%06x\n"

L_.str.3:                               ## @.str.3
	.asciz	"   wrap = %d\n"

L_.str.4:                               ## @.str.4
	.asciz	"  space = 0x%06x\n"

	.comm	_MGA_PRIMEND,4,2                ## @MGA_PRIMEND
L_.str.5:                               ## @.str.5
	.asciz	"done.\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mga_do_dma_wrap_start          ; -- Begin function mga_do_dma_wrap_start
	.p2align	2
_mga_do_dma_wrap_start:                 ; @mga_do_dma_wrap_start
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG
	bl	_BEGIN_DMA_WRAP
Lloh2:
	adrp	x8, _MGA_DMAPAD@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MGA_DMAPAD@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	mov	w1, #0
	mov	x2, x0
	mov	w3, #0
	mov	x4, x0
	mov	w5, #0
	mov	x6, x0
	mov	w7, #0
	bl	_DMA_BLOCK
	bl	_ADVANCE_DMA
	ldr	x8, [x19, #8]
	ldr	x21, [x8]
	str	xzr, [x19, #48]
	ldp	w8, w22, [x19, #32]
                                        ; kill: def $w22 killed $w22 def $x22
	sxtw	x22, w22
	add	w8, w8, #1
	stp	w8, wzr, [x19, #32]
Lloh5:
	adrp	x8, _MGA_PRIMADDRESS@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MGA_PRIMADDRESS@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	bl	_MGA_READ
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	subs	x8, x0, x8
	b.ne	LBB0_2
; %bb.1:
	ldr	x9, [x19, #40]
	b	LBB0_3
LBB0_2:
	mov	x9, x8
LBB0_3:
	add	x20, x19, #16
	str	x9, [x19, #24]
	add	x21, x21, x22
	str	x8, [sp]
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DRM_DEBUG
	ldr	w8, [x19, #36]
	str	x8, [sp]
Lloh10:
	adrp	x0, l_.str.2@PAGE
Lloh11:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DRM_DEBUG
	ldr	w8, [x19, #32]
	str	x8, [sp]
Lloh12:
	adrp	x0, l_.str.3@PAGE
Lloh13:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_DRM_DEBUG
	ldr	x8, [x19, #24]
	str	x8, [sp]
Lloh14:
	adrp	x0, l_.str.4@PAGE
Lloh15:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_DRM_DEBUG
	bl	_mga_flush_write_combine
Lloh16:
	adrp	x8, _MGA_PRIMEND@GOTPAGE
Lloh17:
	ldr	x8, [x8, _MGA_PRIMEND@GOTPAGEOFF]
Lloh18:
	ldr	w0, [x8]
	ldr	x8, [x19]
	orr	x1, x8, x21
	bl	_MGA_WRITE
	mov	w0, #0
	mov	x1, x20
	bl	_set_bit
Lloh19:
	adrp	x0, l_.str.5@PAGE
Lloh20:
	add	x0, x0, l_.str.5@PAGEOFF
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_DRM_DEBUG
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_LOCALS,4,2                 ; @DMA_LOCALS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"\n"

	.comm	_MGA_DMAPAD,4,2                 ; @MGA_DMAPAD
	.comm	_MGA_PRIMADDRESS,4,2            ; @MGA_PRIMADDRESS
l_.str.1:                               ; @.str.1
	.asciz	"   head = 0x%06lx\n"

l_.str.2:                               ; @.str.2
	.asciz	"   tail = 0x%06x\n"

l_.str.3:                               ; @.str.3
	.asciz	"   wrap = %d\n"

l_.str.4:                               ; @.str.4
	.asciz	"  space = 0x%06x\n"

	.comm	_MGA_PRIMEND,4,2                ; @MGA_PRIMEND
l_.str.5:                               ; @.str.5
	.asciz	"done.\n"

.subsections_via_symbols
