	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i9xx_setup_backlight
_i9xx_setup_backlight:                  ## @i9xx_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	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movl	24(%rdi), %edi
	callq	_to_i915
	movq	%rax, %r15
	movq	_BLC_PWM_CTL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_I915_READ
	movl	%eax, %r14d
	movq	%r15, %rdi
	movl	$2, %esi
	callq	_IS_GEN
	testq	%rax, %rax
	jne	LBB0_3
## %bb.1:
	movq	%r15, %rdi
	callq	_IS_I915GM
	testq	%rax, %rax
	jne	LBB0_3
## %bb.2:
	movq	%r15, %rdi
	callq	_IS_I945GM
	testq	%rax, %rax
	je	LBB0_4
LBB0_3:
	movq	_BLM_LEGACY_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%r14d, %eax
	movl	%eax, (%rbx)
LBB0_4:
	movq	%r15, %rdi
	callq	_IS_PINEVIEW
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movq	_BLM_POLARITY_PNV@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%r14d, %eax
	movl	%eax, 4(%rbx)
LBB0_6:
	movl	%r14d, %eax
	sarl	$17, %eax
	movl	%eax, 8(%rbx)
	cmpl	$131071, %r14d                  ## imm = 0x1FFFF
	ja	LBB0_8
## %bb.7:
	movq	%rbx, %rdi
	callq	_get_backlight_max_vbt
	sarl	%eax
	movl	%eax, 8(%rbx)
LBB0_8:
	testl	%eax, %eax
	je	LBB0_9
## %bb.10:
	cmpl	$0, (%rbx)
	je	LBB0_12
## %bb.11:
	movl	%eax, %ecx
	shll	$8, %ecx
	subl	%eax, %ecx
	movl	%ecx, 8(%rbx)
LBB0_12:
	movq	%rbx, %rdi
	callq	_get_backlight_min_vbt
	movl	%eax, 16(%rbx)
	movq	%rbx, %rdi
	callq	_i9xx_get_backlight
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_intel_panel_compute_brightness
	movl	%eax, %r14d
	movl	8(%rbx), %edx
	movl	16(%rbx), %esi
	movl	%eax, %edi
	callq	_clamp
	movl	%eax, 20(%rbx)
	xorl	%eax, %eax
	testl	%r14d, %r14d
	setne	%al
	movl	%eax, 12(%rbx)
	xorl	%eax, %eax
	jmp	LBB0_13
LBB0_9:
	movq	_ENODEV@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_13:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BLC_PWM_CTL,4,2                ## @BLC_PWM_CTL
	.comm	_BLM_LEGACY_MODE,4,2            ## @BLM_LEGACY_MODE
	.comm	_BLM_POLARITY_PNV,4,2           ## @BLM_POLARITY_PNV
	.comm	_ENODEV,4,2                     ## @ENODEV
	.no_dead_strip	_i9xx_setup_backlight
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function i9xx_setup_backlight
_i9xx_setup_backlight:                  ; @i9xx_setup_backlight
	.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
	mov	x19, x0
	ldr	w0, [x0, #24]
	bl	_to_i915
	mov	x21, x0
Lloh0:
	adrp	x8, _BLC_PWM_CTL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BLC_PWM_CTL@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_I915_READ
	mov	x20, x0
	mov	x0, x21
	mov	w1, #2
	bl	_IS_GEN
	cbnz	x0, LBB0_3
; %bb.1:
	mov	x0, x21
	bl	_IS_I915GM
	cbnz	x0, LBB0_3
; %bb.2:
	mov	x0, x21
	bl	_IS_I945GM
	cbz	x0, LBB0_4
LBB0_3:
Lloh3:
	adrp	x8, _BLM_LEGACY_MODE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _BLM_LEGACY_MODE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	and	w8, w8, w20
	str	w8, [x19]
LBB0_4:
	mov	x0, x21
	bl	_IS_PINEVIEW
	cbz	x0, LBB0_6
; %bb.5:
Lloh6:
	adrp	x8, _BLM_POLARITY_PNV@GOTPAGE
Lloh7:
	ldr	x8, [x8, _BLM_POLARITY_PNV@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	and	w8, w8, w20
	str	w8, [x19, #4]
LBB0_6:
	asr	w8, w20, #17
	str	w8, [x19, #8]
	lsr	w9, w20, #17
	cbnz	w9, LBB0_8
; %bb.7:
	mov	x0, x19
	bl	_get_backlight_max_vbt
	asr	w8, w0, #1
	str	w8, [x19, #8]
LBB0_8:
	cbz	w8, LBB0_12
; %bb.9:
	ldr	w9, [x19]
	cbz	w9, LBB0_11
; %bb.10:
	lsl	w9, w8, #8
	sub	w8, w9, w8
	str	w8, [x19, #8]
LBB0_11:
	mov	x0, x19
	bl	_get_backlight_min_vbt
	str	w0, [x19, #16]
	mov	x0, x19
	bl	_i9xx_get_backlight
	mov	x1, x0
	mov	x0, x19
	bl	_intel_panel_compute_brightness
	mov	x20, x0
	ldr	w1, [x19, #16]
	ldr	w2, [x19, #8]
	bl	_clamp
	mov	x8, x0
	mov	w0, #0
	str	w8, [x19, #20]
	cmp	w20, #0
	cset	w8, ne
	str	w8, [x19, #12]
	b	LBB0_13
LBB0_12:
Lloh9:
	adrp	x8, _ENODEV@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_13:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_BLC_PWM_CTL,4,2                ; @BLC_PWM_CTL
	.comm	_BLM_LEGACY_MODE,4,2            ; @BLM_LEGACY_MODE
	.comm	_BLM_POLARITY_PNV,4,2           ; @BLM_POLARITY_PNV
	.comm	_ENODEV,4,2                     ; @ENODEV
	.no_dead_strip	_i9xx_setup_backlight
.subsections_via_symbols
