	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tegra_powergate_remove_clamping ## -- Begin function tegra_powergate_remove_clamping
	.p2align	4, 0x90
_tegra_powergate_remove_clamping:       ## @tegra_powergate_remove_clamping
	.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
	movl	%edi, %ebx
	xorl	%eax, %eax
	callq	_tegra124_pmc_get_sc
	movq	%rax, %r15
	movq	_TEGRA_POWERGATE_3D@GOTPCREL(%rip), %rax
	cmpl	%ebx, (%rax)
	jne	LBB0_2
## %bb.1:
	movq	_PMC_GPU_RG_CNTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_WR4
	jmp	LBB0_10
LBB0_2:
	movq	_PMC_PWRGATE_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_RD4
	movl	%eax, %r14d
	movl	%ebx, %edi
	callq	_PMC_PWRGATE_STATUS_PARTID
	testl	%r14d, %eax
	jne	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rdi
	callq	_panic
LBB0_4:
	movq	_TEGRA_POWERGATE_PCX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_TEGRA_POWERGATE_VDE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpl	%ebx, %ecx
	movl	%ebx, %r13d
	cmovel	%eax, %r13d
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	cmpl	%ebx, %eax
	cmovel	%ecx, %r13d
	movq	_PMC_REMOVE_CLAMPING_CMD@GOTPCREL(%rip), %r12
	movl	(%r12), %ebx
	movl	%r13d, %edi
	callq	_PMC_REMOVE_CLAMPING_CMD_PARTID
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_WR4
	movl	$101, %r14d
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %esi
	movq	%r15, %rdi
	callq	_RD4
	movl	%eax, %ebx
	movl	%r13d, %edi
	callq	_PMC_REMOVE_CLAMPING_CMD_PARTID
	testl	%ebx, %eax
	je	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	$1, %edi
	callq	_DELAY
	decl	%r14d
	cmpl	$1, %r14d
	ja	LBB0_5
## %bb.7:
	movl	(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_device_printf
LBB0_8:
	movq	_PMC_CLAMP_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_RD4
	movl	%eax, %ebx
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	callq	_PMC_CLAMP_STATUS_PARTID
	testl	%ebx, %eax
	je	LBB0_10
## %bb.9:
	leaq	L_.str.2(%rip), %rdi
	callq	_panic
LBB0_10:
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_TEGRA_POWERGATE_3D,4,2         ## @TEGRA_POWERGATE_3D
	.comm	_PMC_GPU_RG_CNTRL,4,2           ## @PMC_GPU_RG_CNTRL
	.comm	_PMC_PWRGATE_STATUS,4,2         ## @PMC_PWRGATE_STATUS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Attempt to remove clamping for unpowered partition.\n"

	.comm	_TEGRA_POWERGATE_PCX,4,2        ## @TEGRA_POWERGATE_PCX
	.comm	_TEGRA_POWERGATE_VDE,4,2        ## @TEGRA_POWERGATE_VDE
	.comm	_PMC_REMOVE_CLAMPING_CMD,4,2    ## @PMC_REMOVE_CLAMPING_CMD
L_.str.1:                               ## @.str.1
	.asciz	"Timeout when remove clamping\n"

	.comm	_PMC_CLAMP_STATUS,4,2           ## @PMC_CLAMP_STATUS
L_.str.2:                               ## @.str.2
	.asciz	"Cannot remove clamping\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tegra_powergate_remove_clamping ; -- Begin function tegra_powergate_remove_clamping
	.p2align	2
_tegra_powergate_remove_clamping:       ; @tegra_powergate_remove_clamping
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
	bl	_tegra124_pmc_get_sc
	mov	x20, x0
Lloh0:
	adrp	x8, _TEGRA_POWERGATE_3D@GOTPAGE
Lloh1:
	ldr	x8, [x8, _TEGRA_POWERGATE_3D@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _PMC_GPU_RG_CNTRL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PMC_GPU_RG_CNTRL@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_WR4
	b	LBB0_10
LBB0_2:
Lloh6:
	adrp	x8, _PMC_PWRGATE_STATUS@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PMC_PWRGATE_STATUS@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_RD4
	mov	x21, x0
	mov	x0, x19
	bl	_PMC_PWRGATE_STATUS_PARTID
	tst	w0, w21
	b.ne	LBB0_4
; %bb.3:
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	bl	_panic
LBB0_4:
Lloh11:
	adrp	x8, _TEGRA_POWERGATE_PCX@GOTPAGE
Lloh12:
	ldr	x8, [x8, _TEGRA_POWERGATE_PCX@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
Lloh14:
	adrp	x9, _TEGRA_POWERGATE_VDE@GOTPAGE
Lloh15:
	ldr	x9, [x9, _TEGRA_POWERGATE_VDE@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	cmp	w9, w19
	csel	w10, w8, w19, eq
	cmp	w8, w19
	csel	w21, w9, w10, eq
Lloh17:
	adrp	x23, _PMC_REMOVE_CLAMPING_CMD@GOTPAGE
Lloh18:
	ldr	x23, [x23, _PMC_REMOVE_CLAMPING_CMD@GOTPAGEOFF]
	ldr	w22, [x23]
	mov	x0, x21
	bl	_PMC_REMOVE_CLAMPING_CMD_PARTID
	mov	x2, x0
	mov	x0, x20
	mov	x1, x22
	bl	_WR4
	mov	w24, #101
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x23]
	mov	x0, x20
	bl	_RD4
	mov	x22, x0
	mov	x0, x21
	bl	_PMC_REMOVE_CLAMPING_CMD_PARTID
	tst	w0, w22
	b.eq	LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	w0, #1
	bl	_DELAY
	sub	w24, w24, #1
	cmp	w24, #1
	b.hi	LBB0_5
; %bb.7:
	ldr	w0, [x20]
Lloh19:
	adrp	x1, l_.str.1@PAGE
Lloh20:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_device_printf
LBB0_8:
Lloh21:
	adrp	x8, _PMC_CLAMP_STATUS@GOTPAGE
Lloh22:
	ldr	x8, [x8, _PMC_CLAMP_STATUS@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_RD4
	mov	x20, x0
	mov	x0, x19
	bl	_PMC_CLAMP_STATUS_PARTID
	tst	w0, w20
	b.eq	LBB0_10
; %bb.9:
Lloh24:
	adrp	x0, l_.str.2@PAGE
Lloh25:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_panic
LBB0_10:
	mov	w0, #0
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_TEGRA_POWERGATE_3D,4,2         ; @TEGRA_POWERGATE_3D
	.comm	_PMC_GPU_RG_CNTRL,4,2           ; @PMC_GPU_RG_CNTRL
	.comm	_PMC_PWRGATE_STATUS,4,2         ; @PMC_PWRGATE_STATUS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Attempt to remove clamping for unpowered partition.\n"

	.comm	_TEGRA_POWERGATE_PCX,4,2        ; @TEGRA_POWERGATE_PCX
	.comm	_TEGRA_POWERGATE_VDE,4,2        ; @TEGRA_POWERGATE_VDE
	.comm	_PMC_REMOVE_CLAMPING_CMD,4,2    ; @PMC_REMOVE_CLAMPING_CMD
l_.str.1:                               ; @.str.1
	.asciz	"Timeout when remove clamping\n"

	.comm	_PMC_CLAMP_STATUS,4,2           ; @PMC_CLAMP_STATUS
l_.str.2:                               ; @.str.2
	.asciz	"Cannot remove clamping\n"

.subsections_via_symbols
