	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function scaler_reset
_scaler_reset:                          ## @scaler_reset
	.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	_SCALER_RESET_WAIT_RETRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_SCALER_CFG_SOFT_RESET@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	movq	_SCALER_CFG@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	callq	_scaler_write
	cmpl	$2, %ebx
	movl	$2, %r12d
	cmovll	%ebx, %r12d
	decl	%r12d
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_cpu_relax
	cmpl	$3, %ebx
	jl	LBB0_2
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	decl	%ebx
	movl	(%r15), %edi
	callq	_scaler_read
	testl	%eax, (%r14)
	jne	LBB0_1
	jmp	LBB0_4
LBB0_2:
	movl	%r12d, %ebx
LBB0_4:
	testl	%ebx, %ebx
	movl	$1, %r14d
	cmovlel	%ebx, %r14d
	decl	%r14d
	movq	_SCALER_INT_EN@GOTPCREL(%rip), %r15
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_cpu_relax
	movl	(%r15), %esi
	movl	$1, %edi
	callq	_scaler_write
	cmpl	$2, %ebx
	jl	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	decl	%ebx
	movl	(%r15), %edi
	callq	_scaler_read
	cmpl	$1, %eax
	jne	LBB0_5
	jmp	LBB0_8
LBB0_6:
	movl	%r14d, %ebx
LBB0_8:
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	xorl	%ecx, %ecx
	testl	%ebx, %ebx
	cmovnel	%ecx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SCALER_RESET_WAIT_RETRIES,4,2  ## @SCALER_RESET_WAIT_RETRIES
	.comm	_SCALER_CFG_SOFT_RESET,4,2      ## @SCALER_CFG_SOFT_RESET
	.comm	_SCALER_CFG,4,2                 ## @SCALER_CFG
	.comm	_SCALER_INT_EN,4,2              ## @SCALER_INT_EN
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_scaler_reset
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function scaler_reset
_scaler_reset:                          ; @scaler_reset
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
Lloh0:
	adrp	x8, _SCALER_RESET_WAIT_RETRIES@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SCALER_RESET_WAIT_RETRIES@GOTPAGEOFF]
Lloh2:
	ldr	w19, [x8]
Lloh3:
	adrp	x20, _SCALER_CFG_SOFT_RESET@GOTPAGE
Lloh4:
	ldr	x20, [x20, _SCALER_CFG_SOFT_RESET@GOTPAGEOFF]
	ldr	w0, [x20]
Lloh5:
	adrp	x21, _SCALER_CFG@GOTPAGE
Lloh6:
	ldr	x21, [x21, _SCALER_CFG@GOTPAGEOFF]
	ldr	w1, [x21]
	bl	_scaler_write
	mov	w8, #2
	cmp	w19, #2
	csel	w8, w19, w8, lt
	sub	w22, w8, #1
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	bl	_cpu_relax
	cmp	w19, #3
	b.lt	LBB0_3
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	sub	w19, w19, #1
	ldr	w0, [x21]
	bl	_scaler_read
	ldr	w8, [x20]
	tst	w8, w0
	b.ne	LBB0_1
	b	LBB0_4
LBB0_3:
	mov	x19, x22
LBB0_4:
	cmp	w19, #1
	csinc	w8, w19, wzr, lt
	sub	w20, w8, #1
Lloh7:
	adrp	x21, _SCALER_INT_EN@GOTPAGE
Lloh8:
	ldr	x21, [x21, _SCALER_INT_EN@GOTPAGEOFF]
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	bl	_cpu_relax
	ldr	w1, [x21]
	mov	w0, #1
	bl	_scaler_write
	cmp	w19, #2
	b.lt	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	sub	w19, w19, #1
	ldr	w0, [x21]
	bl	_scaler_read
	cmp	w0, #1
	b.ne	LBB0_5
	b	LBB0_8
LBB0_7:
	mov	x19, x20
LBB0_8:
Lloh9:
	adrp	x8, _EIO@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w19, #0
	csneg	w0, wzr, w8, ne
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_SCALER_RESET_WAIT_RETRIES,4,2  ; @SCALER_RESET_WAIT_RETRIES
	.comm	_SCALER_CFG_SOFT_RESET,4,2      ; @SCALER_CFG_SOFT_RESET
	.comm	_SCALER_CFG,4,2                 ; @SCALER_CFG
	.comm	_SCALER_INT_EN,4,2              ; @SCALER_INT_EN
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_scaler_reset
.subsections_via_symbols
