	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ar9003_mci_get_next_gpm_offset ## -- Begin function ar9003_mci_get_next_gpm_offset
	.p2align	4, 0x90
_ar9003_mci_get_next_gpm_offset:        ## @ar9003_mci_get_next_gpm_offset
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r13
	movq	%rdi, %r15
	movq	_AR_MCI_INTERRUPT_RX_MSG_RAW@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_AR_MCI_INTERRUPT_RX_MSG_GPM@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_REG_WRITE
	movq	_AR_MCI_GPM_1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_REG_READ
	movq	_AR_MCI_GPM_WRITE_PTR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%eax, %edi
	callq	_MS
	movl	(%r15), %ecx
	movl	%ecx, %r12d
	testl	%eax, %eax
	je	LBB0_4
## %bb.1:
	movl	%eax, %r12d
	cmpl	%ecx, %eax
	jge	LBB0_2
LBB0_4:
	decl	%r12d
	cmpl	$65535, %r12d                   ## imm = 0xFFFF
	jne	LBB0_5
	jmp	LBB0_3
LBB0_2:
	xorl	%r12d, %r12d
	cmpl	$65535, %eax                    ## imm = 0xFFFF
	je	LBB0_3
LBB0_5:
	movl	4(%r15), %edx
	cmpl	%edx, %eax
	jne	LBB0_6
LBB0_3:
	movq	_MCI_GPM_INVALID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_MCI_GPM_NOMORE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r14d
	testq	%r13, %r13
	je	LBB0_20
LBB0_19:
	movl	%r14d, (%r13)
LBB0_20:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	cmpl	%edx, %r12d
	jne	LBB0_7
## %bb.8:
	movq	_MCI_GPM_NOMORE@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_7:
	movq	_MCI_GPM_MORE@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %r14d
	xorl	%eax, %eax
	cmpl	%ecx, %edx
	movl	$0, %ebx
	cmovll	%edx, %ebx
	incl	%edx
	cmpl	%ecx, %edx
	cmovgel	%eax, %edx
	movl	%edx, 4(%r15)
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_ar9003_mci_is_gpm_valid
	testq	%rax, %rax
	movq	%r13, -48(%rbp)                 ## 8-byte Spill
	je	LBB0_12
## %bb.10:
	movl	%r14d, %r13d
LBB0_11:
	movq	_MCI_GPM_INVALID@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%r13d, %r14d
	jmp	LBB0_17
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_12 Depth=1
	movl	(%r15), %ecx
	cmpl	%ecx, %eax
	movl	$0, %ebx
	cmovll	%eax, %ebx
	incl	%eax
	cmpl	%ecx, %eax
	movl	$0, %ecx
	cmovgel	%ecx, %eax
	movl	%eax, 4(%r15)
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_ar9003_mci_is_gpm_valid
	movl	%r13d, %r14d
	testq	%rax, %rax
	jne	LBB0_11
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	_MCI_GPM_NOMORE@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	cmpl	%r13d, %r14d
	je	LBB0_16
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movl	4(%r15), %eax
	cmpl	%eax, %r12d
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	_MCI_GPM_MORE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r13d
	jmp	LBB0_15
LBB0_16:
	movq	_MCI_GPM_INVALID@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%ecx, %ebx
LBB0_17:
	movl	%ebx, %eax
	shll	$4, %eax
	cmpl	%ecx, %ebx
	cmovel	%ebx, %eax
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	testq	%r13, %r13
	jne	LBB0_19
	jmp	LBB0_20
	.cfi_endproc
                                        ## -- End function
	.comm	_AR_MCI_INTERRUPT_RX_MSG_RAW,4,2 ## @AR_MCI_INTERRUPT_RX_MSG_RAW
	.comm	_AR_MCI_INTERRUPT_RX_MSG_GPM,4,2 ## @AR_MCI_INTERRUPT_RX_MSG_GPM
	.comm	_AR_MCI_GPM_1,4,2               ## @AR_MCI_GPM_1
	.comm	_AR_MCI_GPM_WRITE_PTR,4,2       ## @AR_MCI_GPM_WRITE_PTR
	.comm	_MCI_GPM_INVALID,4,2            ## @MCI_GPM_INVALID
	.comm	_MCI_GPM_NOMORE,4,2             ## @MCI_GPM_NOMORE
	.comm	_MCI_GPM_MORE,4,2               ## @MCI_GPM_MORE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ar9003_mci_get_next_gpm_offset ; -- Begin function ar9003_mci_get_next_gpm_offset
	.p2align	2
_ar9003_mci_get_next_gpm_offset:        ; @ar9003_mci_get_next_gpm_offset
	.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, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _AR_MCI_INTERRUPT_RX_MSG_RAW@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AR_MCI_INTERRUPT_RX_MSG_RAW@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x8, _AR_MCI_INTERRUPT_RX_MSG_GPM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AR_MCI_INTERRUPT_RX_MSG_GPM@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	bl	_REG_WRITE
Lloh6:
	adrp	x8, _AR_MCI_GPM_1@GOTPAGE
Lloh7:
	ldr	x8, [x8, _AR_MCI_GPM_1@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_REG_READ
Lloh9:
	adrp	x8, _AR_MCI_GPM_WRITE_PTR@GOTPAGE
Lloh10:
	ldr	x8, [x8, _AR_MCI_GPM_WRITE_PTR@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	bl	_MS
	ldr	w8, [x20]
	cbz	w0, LBB0_4
; %bb.1:
	mov	x9, x0
	cmp	w0, w8
	b.lt	LBB0_5
; %bb.2:
	mov	w9, #65535
	cmp	w0, w9
	b.eq	LBB0_7
; %bb.3:
	mov	w23, #0
	b	LBB0_6
LBB0_4:
	mov	x9, x8
LBB0_5:
	sub	w23, w9, #1
	mov	w9, #65535
	cmp	w23, w9
	b.eq	LBB0_7
LBB0_6:
	ldr	w9, [x20, #4]
	cmp	w0, w9
	b.ne	LBB0_10
LBB0_7:
Lloh12:
	adrp	x8, _MCI_GPM_INVALID@GOTPAGE
Lloh13:
	ldr	x8, [x8, _MCI_GPM_INVALID@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
Lloh15:
	adrp	x8, _MCI_GPM_NOMORE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MCI_GPM_NOMORE@GOTPAGEOFF]
Lloh17:
	ldr	w22, [x8]
	cbz	x19, LBB0_9
LBB0_8:
	str	w22, [x19]
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:
Lloh18:
	adrp	x24, _MCI_GPM_NOMORE@GOTPAGE
Lloh19:
	ldr	x24, [x24, _MCI_GPM_NOMORE@GOTPAGEOFF]
Lloh20:
	adrp	x25, _MCI_GPM_MORE@GOTPAGE
Lloh21:
	ldr	x25, [x25, _MCI_GPM_MORE@GOTPAGEOFF]
	cmp	w23, w9
	csel	x10, x24, x25, eq
	ldr	w22, [x10]
	cmp	w9, w8
	csel	w21, w9, wzr, lt
	add	w10, w9, #1
	cmp	w10, w8
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	csinc	w8, wzr, w9, ge
	str	w8, [x20, #4]
	mov	x0, x20
	mov	x1, x21
	bl	_ar9003_mci_is_gpm_valid
	cbnz	x0, LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	w8, [x24]
	cmp	w22, w8
	b.eq	LBB0_15
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=1
	ldp	w10, w9, [x20]
	ldr	w11, [x25]
	cmp	w23, w9
	csel	w22, w8, w11, eq
	cmp	w9, w10
	csel	w21, w9, wzr, lt
	add	w8, w9, #1
	cmp	w8, w10
	b	LBB0_11
LBB0_14:
Lloh22:
	adrp	x8, _MCI_GPM_INVALID@GOTPAGE
Lloh23:
	ldr	x8, [x8, _MCI_GPM_INVALID@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	b	LBB0_16
LBB0_15:
Lloh25:
	adrp	x8, _MCI_GPM_INVALID@GOTPAGE
Lloh26:
	ldr	x8, [x8, _MCI_GPM_INVALID@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	mov	x21, x8
LBB0_16:
	lsl	w9, w21, #4
	cmp	w21, w8
	csel	w0, w21, w9, eq
	cbnz	x19, LBB0_8
	b	LBB0_9
	.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 AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_AR_MCI_INTERRUPT_RX_MSG_RAW,4,2 ; @AR_MCI_INTERRUPT_RX_MSG_RAW
	.comm	_AR_MCI_INTERRUPT_RX_MSG_GPM,4,2 ; @AR_MCI_INTERRUPT_RX_MSG_GPM
	.comm	_AR_MCI_GPM_1,4,2               ; @AR_MCI_GPM_1
	.comm	_AR_MCI_GPM_WRITE_PTR,4,2       ; @AR_MCI_GPM_WRITE_PTR
	.comm	_MCI_GPM_INVALID,4,2            ; @MCI_GPM_INVALID
	.comm	_MCI_GPM_NOMORE,4,2             ; @MCI_GPM_NOMORE
	.comm	_MCI_GPM_MORE,4,2               ; @MCI_GPM_MORE
.subsections_via_symbols
