	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function htc_check_credits
_htc_check_credits:                     ## @htc_check_credits
	.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	%r9, %r15
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%rsi, %rbx
	movq	%rdi, %r12
	movl	(%rdi), %esi
	movl	$1, %edx
	cmpl	%r8d, %esi
	jae	LBB0_2
## %bb.1:
	movl	%r8d, %edi
	callq	_DIV_ROUND_UP
	movl	%eax, %edx
LBB0_2:
	movl	%edx, (%r15)
	movq	_ATH6KL_DBG_CREDIT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	8(%rbx), %r13
	movl	8(%rbx), %ecx
	leaq	L_.str(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_ath6kl_dbg
	movl	8(%rbx), %eax
	movl	(%r15), %ecx
	movl	%ecx, %edx
	subl	%eax, %edx
	jle	LBB0_7
## %bb.3:
	movq	_ENDPOINT_0@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	cmpl	%ecx, (%rax)
	jne	LBB0_5
## %bb.4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_10
LBB0_5:
	movl	%edx, 12(%rbx)
	movl	4(%r12), %edi
	movq	%r13, %rsi
	callq	_ath6kl_credit_seek
	movl	$0, 12(%rbx)
	movl	8(%rbx), %eax
	movl	(%r15), %ecx
	cmpl	%ecx, %eax
	jge	LBB0_7
## %bb.6:
	movq	_ATH6KL_DBG_CREDIT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%r14d, %r14d
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	xorl	%eax, %eax
	callq	_ath6kl_dbg
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	jmp	LBB0_10
LBB0_7:
	subl	%ecx, %eax
	movl	%eax, 8(%rbx)
	movl	(%r15), %ecx
	addl	%ecx, (%rbx)
	movl	16(%rbx), %ecx
	subl	%eax, %ecx
	jle	LBB0_10
## %bb.8:
	movl	%ecx, 12(%rbx)
	movl	4(%r12), %edi
	movq	%r13, %rsi
	callq	_ath6kl_credit_seek
	movl	8(%rbx), %eax
	cmpl	16(%rbx), %eax
	jge	LBB0_10
## %bb.9:
	movq	_HTC_FLAGS_NEED_CREDIT_UPDATE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	orl	%eax, (%rcx)
	incl	4(%rbx)
	movq	_ATH6KL_DBG_CREDIT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.2(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_ath6kl_dbg
LBB0_10:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ATH6KL_DBG_CREDIT,4,2          ## @ATH6KL_DBG_CREDIT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"credit check need %d got %d\n"

	.comm	_ENDPOINT_0,4,2                 ## @ENDPOINT_0
	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"credit not found for ep %d\n"

	.comm	_HTC_FLAGS_NEED_CREDIT_UPDATE,4,2 ## @HTC_FLAGS_NEED_CREDIT_UPDATE
L_.str.2:                               ## @.str.2
	.asciz	"credit we need credits asap\n"

	.no_dead_strip	_htc_check_credits
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function htc_check_credits
_htc_check_credits:                     ; @htc_check_credits
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x21, x5
	mov	x23, x3
	mov	x20, x2
	mov	x19, x1
	mov	x22, x0
	ldr	w1, [x0]
	cmp	w1, w4
	b.hs	LBB0_2
; %bb.1:
	mov	x0, x4
	bl	_DIV_ROUND_UP
                                        ; kill: def $w0 killed $w0 def $x0
	b	LBB0_3
LBB0_2:
	mov	w0, #1
LBB0_3:
	str	w0, [x21]
Lloh0:
	adrp	x25, _ATH6KL_DBG_CREDIT@GOTPAGE
Lloh1:
	ldr	x25, [x25, _ATH6KL_DBG_CREDIT@GOTPAGEOFF]
	ldr	w8, [x25]
	mov	x24, x19
	ldr	w9, [x24, #8]!
	stp	x0, x9, [sp]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x8
	bl	_ath6kl_dbg
	ldr	w8, [x24]
	ldr	w9, [x21]
	subs	w10, w9, w8
	b.le	LBB0_8
; %bb.4:
Lloh4:
	adrp	x8, _ENDPOINT_0@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ENDPOINT_0@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	cmp	w8, w23
	b.eq	LBB0_7
; %bb.5:
	str	w10, [x19, #12]
	ldr	w0, [x22, #4]
	mov	x1, x24
	bl	_ath6kl_credit_seek
	str	wzr, [x19, #12]
	ldr	w8, [x19, #8]
	ldr	w9, [x21]
	cmp	w8, w9
	b.ge	LBB0_8
; %bb.6:
	ldr	w0, [x25]
	str	x23, [sp]
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_ath6kl_dbg
LBB0_7:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_12
LBB0_8:
	ldr	w10, [x19, #16]
	sub	w9, w8, w9
	subs	w8, w10, w9
	str	w9, [x19, #8]
	ldr	w9, [x21]
	ldr	w10, [x19]
	add	w9, w10, w9
	str	w9, [x19]
	b.le	LBB0_11
; %bb.9:
	str	w8, [x19, #12]
	ldr	w0, [x22, #4]
	mov	x1, x24
	bl	_ath6kl_credit_seek
	ldr	w8, [x19, #8]
	ldr	w9, [x19, #16]
	cmp	w8, w9
	b.ge	LBB0_11
; %bb.10:
Lloh12:
	adrp	x8, _HTC_FLAGS_NEED_CREDIT_UPDATE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _HTC_FLAGS_NEED_CREDIT_UPDATE@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	ldr	w9, [x20]
	orr	w8, w9, w8
	str	w8, [x20]
	ldr	w8, [x19, #4]
	add	w8, w8, #1
	str	w8, [x19, #4]
	ldr	w0, [x25]
Lloh15:
	adrp	x1, l_.str.2@PAGE
Lloh16:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_ath6kl_dbg
LBB0_11:
	mov	w0, #0
LBB0_12:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_ATH6KL_DBG_CREDIT,4,2          ; @ATH6KL_DBG_CREDIT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"credit check need %d got %d\n"

	.comm	_ENDPOINT_0,4,2                 ; @ENDPOINT_0
	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"credit not found for ep %d\n"

	.comm	_HTC_FLAGS_NEED_CREDIT_UPDATE,4,2 ; @HTC_FLAGS_NEED_CREDIT_UPDATE
l_.str.2:                               ; @.str.2
	.asciz	"credit we need credits asap\n"

	.no_dead_strip	_htc_check_credits
.subsections_via_symbols
