	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pch_setup_backlight
_pch_setup_backlight:                   ## @pch_setup_backlight
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	movl	20(%rdi), %edi
	callq	_to_i915
	movq	_BLC_PWM_PCH_CTL1@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_I915_READ
	movl	%eax, %r14d
	movq	_BLM_PCH_POLARITY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%r14d, %eax
	movl	%eax, (%rbx)
	movq	_BLC_PWM_PCH_CTL2@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_I915_READ
	movl	%eax, %ecx
	sarl	$16, %eax
	movl	%eax, 4(%rbx)
	cmpl	$65535, %ecx                    ## imm = 0xFFFF
	ja	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_get_backlight_max_vbt
	movl	%eax, 4(%rbx)
LBB0_2:
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	movq	%rbx, %rdi
	callq	_get_backlight_min_vbt
	movl	%eax, 12(%rbx)
	movq	%rbx, %rdi
	callq	_pch_get_backlight
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_intel_panel_compute_brightness
	movl	4(%rbx), %edx
	movl	12(%rbx), %esi
	movl	%eax, %edi
	callq	_clamp
	movl	%eax, 16(%rbx)
	movq	_BLC_PWM_CPU_CTL2@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_I915_READ
	movq	_BLM_PWM_ENABLE@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	setne	%al
	movq	_BLM_PCH_PWM_ENABLE@GOTPCREL(%rip), %rcx
	andl	(%rcx), %r14d
	setne	%cl
	andb	%al, %cl
	movzbl	%cl, %eax
	movl	%eax, 8(%rbx)
	xorl	%eax, %eax
	jmp	LBB0_5
LBB0_3:
	movq	_ENODEV@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_5:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BLC_PWM_PCH_CTL1,4,2           ## @BLC_PWM_PCH_CTL1
	.comm	_BLM_PCH_POLARITY,4,2           ## @BLM_PCH_POLARITY
	.comm	_BLC_PWM_PCH_CTL2,4,2           ## @BLC_PWM_PCH_CTL2
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_BLC_PWM_CPU_CTL2,4,2           ## @BLC_PWM_CPU_CTL2
	.comm	_BLM_PWM_ENABLE,4,2             ## @BLM_PWM_ENABLE
	.comm	_BLM_PCH_PWM_ENABLE,4,2         ## @BLM_PCH_PWM_ENABLE
	.no_dead_strip	_pch_setup_backlight
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pch_setup_backlight
_pch_setup_backlight:                   ; @pch_setup_backlight
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	w0, [x0, #20]
	bl	_to_i915
Lloh0:
	adrp	x8, _BLC_PWM_PCH_CTL1@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BLC_PWM_PCH_CTL1@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_I915_READ
	mov	x20, x0
Lloh3:
	adrp	x8, _BLM_PCH_POLARITY@GOTPAGE
Lloh4:
	ldr	x8, [x8, _BLM_PCH_POLARITY@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	and	w8, w8, w0
	str	w8, [x19]
Lloh6:
	adrp	x8, _BLC_PWM_PCH_CTL2@GOTPAGE
Lloh7:
	ldr	x8, [x8, _BLC_PWM_PCH_CTL2@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	bl	_I915_READ
	mov	x8, x0
	asr	w0, w0, #16
	str	w0, [x19, #4]
	lsr	w8, w8, #16
	cbnz	w8, LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_get_backlight_max_vbt
	str	w0, [x19, #4]
LBB0_2:
	cbz	w0, LBB0_4
; %bb.3:
	mov	x0, x19
	bl	_get_backlight_min_vbt
	str	w0, [x19, #12]
	mov	x0, x19
	bl	_pch_get_backlight
	mov	x1, x0
	mov	x0, x19
	bl	_intel_panel_compute_brightness
	ldr	w1, [x19, #12]
	ldr	w2, [x19, #4]
	bl	_clamp
	str	w0, [x19, #16]
Lloh9:
	adrp	x8, _BLC_PWM_CPU_CTL2@GOTPAGE
Lloh10:
	ldr	x8, [x8, _BLC_PWM_CPU_CTL2@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	bl	_I915_READ
	mov	x8, x0
	mov	w0, #0
Lloh12:
	adrp	x9, _BLM_PWM_ENABLE@GOTPAGE
Lloh13:
	ldr	x9, [x9, _BLM_PWM_ENABLE@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w9, w8
Lloh15:
	adrp	x8, _BLM_PCH_PWM_ENABLE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _BLM_PCH_PWM_ENABLE@GOTPAGEOFF]
	cset	w9, ne
Lloh17:
	ldr	w8, [x8]
	tst	w8, w20
	cset	w8, ne
	and	w8, w9, w8
	str	w8, [x19, #8]
	b	LBB0_5
LBB0_4:
Lloh18:
	adrp	x8, _ENODEV@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_5:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.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 AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_BLC_PWM_PCH_CTL1,4,2           ; @BLC_PWM_PCH_CTL1
	.comm	_BLM_PCH_POLARITY,4,2           ; @BLM_PCH_POLARITY
	.comm	_BLC_PWM_PCH_CTL2,4,2           ; @BLC_PWM_PCH_CTL2
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_BLC_PWM_CPU_CTL2,4,2           ; @BLC_PWM_CPU_CTL2
	.comm	_BLM_PWM_ENABLE,4,2             ; @BLM_PWM_ENABLE
	.comm	_BLM_PCH_PWM_ENABLE,4,2         ; @BLM_PCH_PWM_ENABLE
	.no_dead_strip	_pch_setup_backlight
.subsections_via_symbols
