	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amdgpu_atpx_validate
_amdgpu_atpx_validate:                  ## @amdgpu_atpx_validate
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	cmpq	$0, 24(%rdi)
	je	LBB0_1
## %bb.2:
	movl	32(%r14), %edi
	movq	_ATPX_FUNCTION_GET_PX_PARAMETERS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%ebx, %ebx
	xorl	%edx, %edx
	callq	_amdgpu_atpx_call
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %r15
	leaq	-32(%rbp), %rdi
	xorl	%esi, %esi
	movl	$8, %edx
	callq	_memset
	movq	(%r15), %rax
	movq	(%rax), %rsi
	cmpq	$9, %rsi
	ja	LBB0_7
## %bb.5:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_printk
	movq	%r15, %rdi
	callq	_kfree
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_20
LBB0_1:
	xorl	%ebx, %ebx
	jmp	LBB0_8
LBB0_3:
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_20
LBB0_7:
	movl	$8, %edi
	callq	_min
	movq	(%r15), %rsi
	leaq	-32(%rbp), %rdi
	movq	%rax, %rdx
	callq	_memcpy
	movl	-28(%rbp), %ebx
	andl	-32(%rbp), %ebx
	movq	%r15, %rdi
	callq	_kfree
LBB0_8:
	movq	_ATPX_SEPARATE_MUX_FOR_I2C@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_10
## %bb.9:
	movabsq	$4294967297, %rax               ## imm = 0x100000001
	movq	%rax, 8(%r14)
LBB0_10:
	movq	_ATPX_CRT1_RGB_SIGNAL_MUXED@GOTPCREL(%rip), %rax
	movq	_ATPX_TV_SIGNAL_MUXED@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	_ATPX_DFP_SIGNAL_MUXED@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	testl	%ebx, %ecx
	je	LBB0_12
## %bb.11:
	movl	$1, 12(%r14)
LBB0_12:
	movq	_ATPX_DYNAMIC_PX_SUPPORTED@GOTPCREL(%rip), %rax
	movq	_ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	testl	%ebx, %ecx
	je	LBB0_14
## %bb.13:
	movl	$1, 16(%r14)
LBB0_14:
	movl	$0, (%r14)
	movq	_ATPX_MS_HYBRID_GFX_SUPPORTED@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_19
## %bb.15:
	movq	_amdgpu_atpx_priv@GOTPCREL(%rip), %r15
	movq	_AMDGPU_PX_QUIRK_FORCE_ATPX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r15)
	je	LBB0_17
## %bb.16:
	leaq	L_.str.1(%rip), %rdi
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_printk
	movl	$1, %eax
	jmp	LBB0_18
LBB0_17:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_printk
	xorl	%eax, %eax
	cmpl	$0, 4(%r15)
	sete	%al
	movl	$1, %r15d
LBB0_18:
	movl	%eax, 16(%r14)
	movl	%r15d, (%r14)
LBB0_19:
	movq	_ATPX_DGPU_REQ_POWER_FOR_DISPLAYS@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	andl	(%rax), %ebx
	setne	%cl
	movl	%ecx, 4(%r14)
	xorl	%ebx, %ebx
LBB0_20:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ATPX_FUNCTION_GET_PX_PARAMETERS,4,2 ## @ATPX_FUNCTION_GET_PX_PARAMETERS
	.comm	_EIO,4,2                        ## @EIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ATPX buffer is too small: %zu\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ATPX_SEPARATE_MUX_FOR_I2C,4,2  ## @ATPX_SEPARATE_MUX_FOR_I2C
	.comm	_ATPX_CRT1_RGB_SIGNAL_MUXED,4,2 ## @ATPX_CRT1_RGB_SIGNAL_MUXED
	.comm	_ATPX_TV_SIGNAL_MUXED,4,2       ## @ATPX_TV_SIGNAL_MUXED
	.comm	_ATPX_DFP_SIGNAL_MUXED,4,2      ## @ATPX_DFP_SIGNAL_MUXED
	.comm	_ATPX_DYNAMIC_PX_SUPPORTED,4,2  ## @ATPX_DYNAMIC_PX_SUPPORTED
	.comm	_ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED,4,2 ## @ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED
	.comm	_ATPX_MS_HYBRID_GFX_SUPPORTED,4,2 ## @ATPX_MS_HYBRID_GFX_SUPPORTED
	.comm	_amdgpu_atpx_priv,8,2           ## @amdgpu_atpx_priv
	.comm	_AMDGPU_PX_QUIRK_FORCE_ATPX,4,2 ## @AMDGPU_PX_QUIRK_FORCE_ATPX
L_.str.1:                               ## @.str.1
	.asciz	"ATPX Hybrid Graphics, forcing to ATPX\n"

L_.str.2:                               ## @.str.2
	.asciz	"ATPX Hybrid Graphics\n"

	.comm	_ATPX_DGPU_REQ_POWER_FOR_DISPLAYS,4,2 ## @ATPX_DGPU_REQ_POWER_FOR_DISPLAYS
	.no_dead_strip	_amdgpu_atpx_validate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function amdgpu_atpx_validate
_amdgpu_atpx_validate:                  ; @amdgpu_atpx_validate
	.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
	ldr	x8, [x0, #24]
	cbz	x8, LBB0_4
; %bb.1:
	ldr	w0, [x19, #32]
Lloh0:
	adrp	x8, _ATPX_FUNCTION_GET_PX_PARAMETERS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ATPX_FUNCTION_GET_PX_PARAMETERS@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x2, #0
	bl	_amdgpu_atpx_call
	cbz	x0, LBB0_5
; %bb.2:
	mov	x20, x0
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #8
	bl	_memset
	ldr	x8, [x20]
	ldr	x1, [x8]
	cmp	x1, #9
	b.hi	LBB0_7
; %bb.3:
	str	x1, [sp]
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_printk
	mov	x0, x20
	bl	_kfree
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_6
LBB0_4:
	mov	w21, #0
	b	LBB0_8
LBB0_5:
Lloh7:
	adrp	x8, _EIO@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_20
LBB0_7:
	mov	w0, #8
	bl	_min
	mov	x2, x0
	ldr	x1, [x20]
	add	x0, sp, #8
	bl	_memcpy
	ldp	w8, w9, [sp, #8]
	and	w21, w9, w8
	mov	x0, x20
	bl	_kfree
LBB0_8:
Lloh9:
	adrp	x8, _ATPX_SEPARATE_MUX_FOR_I2C@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ATPX_SEPARATE_MUX_FOR_I2C@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	tst	w8, w21
	b.eq	LBB0_10
; %bb.9:
	movi.2s	v0, #1
	str	d0, [x19, #8]
LBB0_10:
Lloh12:
	adrp	x8, _ATPX_CRT1_RGB_SIGNAL_MUXED@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ATPX_CRT1_RGB_SIGNAL_MUXED@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
Lloh15:
	adrp	x9, _ATPX_TV_SIGNAL_MUXED@GOTPAGE
Lloh16:
	ldr	x9, [x9, _ATPX_TV_SIGNAL_MUXED@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh18:
	adrp	x9, _ATPX_DFP_SIGNAL_MUXED@GOTPAGE
Lloh19:
	ldr	x9, [x9, _ATPX_DFP_SIGNAL_MUXED@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	orr	w8, w8, w9
	tst	w8, w21
	b.eq	LBB0_12
; %bb.11:
	mov	w8, #1
	str	w8, [x19, #12]
LBB0_12:
Lloh21:
	adrp	x8, _ATPX_DYNAMIC_PX_SUPPORTED@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ATPX_DYNAMIC_PX_SUPPORTED@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
Lloh24:
	adrp	x9, _ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED@GOTPAGE
Lloh25:
	ldr	x9, [x9, _ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	orr	w8, w9, w8
	tst	w8, w21
	b.eq	LBB0_14
; %bb.13:
	mov	w8, #1
	str	w8, [x19, #16]
LBB0_14:
	str	wzr, [x19]
Lloh27:
	adrp	x8, _ATPX_MS_HYBRID_GFX_SUPPORTED@GOTPAGE
Lloh28:
	ldr	x8, [x8, _ATPX_MS_HYBRID_GFX_SUPPORTED@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	tst	w8, w21
	b.eq	LBB0_19
; %bb.15:
Lloh30:
	adrp	x20, _amdgpu_atpx_priv@GOTPAGE
Lloh31:
	ldr	x20, [x20, _amdgpu_atpx_priv@GOTPAGEOFF]
	ldr	w8, [x20]
Lloh32:
	adrp	x9, _AMDGPU_PX_QUIRK_FORCE_ATPX@GOTPAGE
Lloh33:
	ldr	x9, [x9, _AMDGPU_PX_QUIRK_FORCE_ATPX@GOTPAGEOFF]
Lloh34:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_17
; %bb.16:
Lloh35:
	adrp	x0, l_.str.1@PAGE
Lloh36:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_printk
	mov	w8, #0
	mov	w9, #1
	b	LBB0_18
LBB0_17:
Lloh37:
	adrp	x0, l_.str.2@PAGE
Lloh38:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_printk
	ldr	w8, [x20, #4]
	cmp	w8, #0
	cset	w9, eq
	mov	w8, #1
LBB0_18:
	str	w9, [x19, #16]
	str	w8, [x19]
LBB0_19:
	mov	w0, #0
Lloh39:
	adrp	x8, _ATPX_DGPU_REQ_POWER_FOR_DISPLAYS@GOTPAGE
Lloh40:
	ldr	x8, [x8, _ATPX_DGPU_REQ_POWER_FOR_DISPLAYS@GOTPAGEOFF]
Lloh41:
	ldr	w8, [x8]
	tst	w8, w21
	cset	w8, ne
	str	w8, [x19, #4]
LBB0_20:
	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
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpAdd	Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.cfi_endproc
                                        ; -- End function
	.comm	_ATPX_FUNCTION_GET_PX_PARAMETERS,4,2 ; @ATPX_FUNCTION_GET_PX_PARAMETERS
	.comm	_EIO,4,2                        ; @EIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ATPX buffer is too small: %zu\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ATPX_SEPARATE_MUX_FOR_I2C,4,2  ; @ATPX_SEPARATE_MUX_FOR_I2C
	.comm	_ATPX_CRT1_RGB_SIGNAL_MUXED,4,2 ; @ATPX_CRT1_RGB_SIGNAL_MUXED
	.comm	_ATPX_TV_SIGNAL_MUXED,4,2       ; @ATPX_TV_SIGNAL_MUXED
	.comm	_ATPX_DFP_SIGNAL_MUXED,4,2      ; @ATPX_DFP_SIGNAL_MUXED
	.comm	_ATPX_DYNAMIC_PX_SUPPORTED,4,2  ; @ATPX_DYNAMIC_PX_SUPPORTED
	.comm	_ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED,4,2 ; @ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED
	.comm	_ATPX_MS_HYBRID_GFX_SUPPORTED,4,2 ; @ATPX_MS_HYBRID_GFX_SUPPORTED
	.comm	_amdgpu_atpx_priv,8,2           ; @amdgpu_atpx_priv
	.comm	_AMDGPU_PX_QUIRK_FORCE_ATPX,4,2 ; @AMDGPU_PX_QUIRK_FORCE_ATPX
l_.str.1:                               ; @.str.1
	.asciz	"ATPX Hybrid Graphics, forcing to ATPX\n"

l_.str.2:                               ; @.str.2
	.asciz	"ATPX Hybrid Graphics\n"

	.comm	_ATPX_DGPU_REQ_POWER_FOR_DISPLAYS,4,2 ; @ATPX_DGPU_REQ_POWER_FOR_DISPLAYS
	.no_dead_strip	_amdgpu_atpx_validate
.subsections_via_symbols
