	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i965_setup_backlight
_i965_setup_backlight:                  ## @i965_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	24(%rdi), %edi
	callq	_to_i915
	movq	_BLC_PWM_CTL2@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_I915_READ
	movl	%eax, %r14d
	movq	_BLM_COMBINATION_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%r14d, %eax
	movl	%eax, (%rbx)
	movq	_BLM_POLARITY_I965@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%r14d, %eax
	movl	%eax, 4(%rbx)
	movq	_BLC_PWM_CTL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_I915_READ
	movl	%eax, %ecx
	sarl	$16, %eax
	movl	%eax, 8(%rbx)
	cmpl	$65535, %ecx                    ## imm = 0xFFFF
	ja	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_get_backlight_max_vbt
	movl	%eax, 8(%rbx)
LBB0_2:
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	cmpl	$0, (%rbx)
	je	LBB0_6
## %bb.5:
	movl	%eax, %ecx
	shll	$8, %ecx
	subl	%eax, %ecx
	movl	%ecx, 8(%rbx)
LBB0_6:
	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	8(%rbx), %edx
	movl	16(%rbx), %esi
	movl	%eax, %edi
	callq	_clamp
	movl	%eax, 20(%rbx)
	movq	_BLM_PWM_ENABLE@GOTPCREL(%rip), %rax
	andl	(%rax), %r14d
	movl	%r14d, 12(%rbx)
	xorl	%eax, %eax
	jmp	LBB0_7
LBB0_3:
	movq	_ENODEV@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_7:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BLC_PWM_CTL2,4,2               ## @BLC_PWM_CTL2
	.comm	_BLM_COMBINATION_MODE,4,2       ## @BLM_COMBINATION_MODE
	.comm	_BLM_POLARITY_I965,4,2          ## @BLM_POLARITY_I965
	.comm	_BLC_PWM_CTL,4,2                ## @BLC_PWM_CTL
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_BLM_PWM_ENABLE,4,2             ## @BLM_PWM_ENABLE
	.no_dead_strip	_i965_setup_backlight
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function i965_setup_backlight
_i965_setup_backlight:                  ; @i965_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, #24]
	bl	_to_i915
Lloh0:
	adrp	x8, _BLC_PWM_CTL2@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BLC_PWM_CTL2@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_I915_READ
	mov	x20, x0
Lloh3:
	adrp	x8, _BLM_COMBINATION_MODE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _BLM_COMBINATION_MODE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	and	w8, w8, w0
	str	w8, [x19]
Lloh6:
	adrp	x8, _BLM_POLARITY_I965@GOTPAGE
Lloh7:
	ldr	x8, [x8, _BLM_POLARITY_I965@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	and	w8, w8, w0
	str	w8, [x19, #4]
Lloh9:
	adrp	x8, _BLC_PWM_CTL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _BLC_PWM_CTL@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	bl	_I915_READ
	mov	x8, x0
	asr	w0, w0, #16
	str	w0, [x19, #8]
	lsr	w8, w8, #16
	cbnz	w8, LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_get_backlight_max_vbt
	str	w0, [x19, #8]
LBB0_2:
	cbz	w0, LBB0_6
; %bb.3:
	ldr	w8, [x19]
	cbz	w8, LBB0_5
; %bb.4:
	lsl	w8, w0, #8
	sub	w8, w8, w0
	str	w8, [x19, #8]
LBB0_5:
	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
	ldr	w1, [x19, #16]
	ldr	w2, [x19, #8]
	bl	_clamp
	mov	x8, x0
	mov	w0, #0
	str	w8, [x19, #20]
Lloh12:
	adrp	x8, _BLM_PWM_ENABLE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _BLM_PWM_ENABLE@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	and	w8, w8, w20
	str	w8, [x19, #12]
	b	LBB0_7
LBB0_6:
Lloh15:
	adrp	x8, _ENODEV@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_7:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_BLC_PWM_CTL2,4,2               ; @BLC_PWM_CTL2
	.comm	_BLM_COMBINATION_MODE,4,2       ; @BLM_COMBINATION_MODE
	.comm	_BLM_POLARITY_I965,4,2          ; @BLM_POLARITY_I965
	.comm	_BLC_PWM_CTL,4,2                ; @BLC_PWM_CTL
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_BLM_PWM_ENABLE,4,2             ; @BLM_PWM_ENABLE
	.no_dead_strip	_i965_setup_backlight
.subsections_via_symbols
