	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function adv7511_mode_set
_adv7511_mode_set:                      ## @adv7511_mode_set
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r13
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	cmpq	$0, 32(%rdi)
	je	LBB0_2
## %bb.1:
	movl	(%r13), %r15d
	movl	8(%r13), %eax
	movq	%r13, %r12
	movl	16(%r13), %r13d
	subl	%r15d, %r13d
	subl	4(%r12), %r15d
	movl	20(%r12), %ecx
	subl	%eax, %ecx
	movl	%ecx, -60(%rbp)                 ## 4-byte Spill
	movl	%eax, %r14d
	subl	12(%r12), %r14d
	incl	%r14d
	movl	24(%rbx), %edi
	movq	_ADV7511_REG_HSYNC_PLACEMENT_MSB@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, %edx
	shrl	$5, %edx
	andl	$224, %edx
	callq	_regmap_write
	movl	24(%rbx), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	xorl	%edi, %edi
	callq	_ADV7511_REG_SYNC_DECODER
	movl	%r15d, %ecx
	shrl	$2, %ecx
	movzbl	%cl, %edx
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%eax, %esi
	callq	_regmap_write
	movl	24(%rbx), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	$1, %edi
	callq	_ADV7511_REG_SYNC_DECODER
	shll	$6, %r15d
	movzbl	%r15b, %ecx
	movl	%r13d, %edx
	shrl	$4, %edx
	andl	$63, %edx
	orl	%ecx, %edx
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%eax, %esi
	callq	_regmap_write
	movl	24(%rbx), %r15d
	movl	$2, %edi
	callq	_ADV7511_REG_SYNC_DECODER
	shll	$4, %r13d
	movzbl	%r13b, %ecx
	movq	%r12, %r13
	movl	%r14d, %edx
	shrl	$6, %edx
	andl	$15, %edx
	orl	%ecx, %edx
	movl	%r15d, %edi
	movl	%eax, %esi
	callq	_regmap_write
	movl	24(%rbx), %r12d
	movl	$3, %edi
	callq	_ADV7511_REG_SYNC_DECODER
	andl	$63, %r14d
	movl	-60(%rbp), %r15d                ## 4-byte Reload
	movl	%r15d, %ecx
	shrl	$8, %ecx
	andl	$3, %ecx
	leal	(%rcx,%r14,4), %edx
	movl	%r12d, %edi
	movl	%eax, %esi
	callq	_regmap_write
	movl	24(%rbx), %r12d
	movl	$4, %edi
	callq	_ADV7511_REG_SYNC_DECODER
	movzbl	%r15b, %edx
	movl	%r12d, %edi
	movl	%eax, %esi
	callq	_regmap_write
	movl	24(%r13), %eax
	movq	_DRM_MODE_FLAG_PHSYNC@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	sete	%r14b
	movq	_DRM_MODE_FLAG_PVSYNC@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	sete	%r12b
	jmp	LBB0_3
LBB0_2:
	movl	24(%r13), %eax
	movq	_DRM_MODE_FLAG_NHSYNC@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	movq	_ADV7511_SYNC_POLARITY_HIGH@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_ADV7511_SYNC_POLARITY_LOW@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	movl	%edx, %esi
	cmovel	%ecx, %esi
	movq	_DRM_MODE_FLAG_NVSYNC@GOTPCREL(%rip), %rdi
	testl	%eax, (%rdi)
	cmovel	%ecx, %edx
	movslq	(%rbx), %rax
	cmpl	%esi, %eax
	setne	%cl
	movq	_ADV7511_SYNC_POLARITY_PASSTHROUGH@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rsi
	cmpq	%rax, %rsi
	setne	%r14b
	andb	%cl, %r14b
	movslq	4(%rbx), %rax
	cmpl	%edx, %eax
	setne	%cl
	cmpq	%rax, %rsi
	setne	%r12b
	andb	%cl, %r12b
LBB0_3:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_drm_mode_vrefresh
	cmpl	$25, %eax
	jge	LBB0_5
## %bb.4:
	movq	_ADV7511_LOW_REFRESH_RATE_24HZ@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_5:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_drm_mode_vrefresh
	cmpl	$26, %eax
	jge	LBB0_7
## %bb.6:
	movq	_ADV7511_LOW_REFRESH_RATE_25HZ@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_7:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_drm_mode_vrefresh
	cmpl	$31, %eax
	jge	LBB0_8
## %bb.9:
	movq	_ADV7511_LOW_REFRESH_RATE_30HZ@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_8:
	movq	_ADV7511_LOW_REFRESH_RATE_NONE@GOTPCREL(%rip), %rax
LBB0_10:
	movl	(%rax), %ecx
	movl	24(%rbx), %edi
	addl	%ecx, %ecx
	movl	$251, %esi
	movl	$6, %edx
	callq	_regmap_update_bits
	movl	24(%rbx), %edi
	movzbl	%r12b, %eax
	shll	$6, %eax
	movzbl	%r14b, %ecx
	shll	$5, %ecx
	orl	%eax, %ecx
	movl	$23, %esi
	movl	$96, %edx
	callq	_regmap_update_bits
	movq	8(%rbx), %rax
	movq	_ADV7533@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_12
## %bb.11:
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_adv7533_mode_set
LBB0_12:
	leaq	20(%rbx), %rdi
	movq	%r13, %rsi
	callq	_drm_mode_copy
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	28(%rax), %eax
	movl	%eax, 16(%rbx)
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ADV7511_REG_HSYNC_PLACEMENT_MSB,4,2 ## @ADV7511_REG_HSYNC_PLACEMENT_MSB
	.comm	_DRM_MODE_FLAG_PHSYNC,4,2       ## @DRM_MODE_FLAG_PHSYNC
	.comm	_DRM_MODE_FLAG_PVSYNC,4,2       ## @DRM_MODE_FLAG_PVSYNC
	.comm	_DRM_MODE_FLAG_NHSYNC,4,2       ## @DRM_MODE_FLAG_NHSYNC
	.comm	_ADV7511_SYNC_POLARITY_LOW,4,2  ## @ADV7511_SYNC_POLARITY_LOW
	.comm	_ADV7511_SYNC_POLARITY_HIGH,4,2 ## @ADV7511_SYNC_POLARITY_HIGH
	.comm	_DRM_MODE_FLAG_NVSYNC,4,2       ## @DRM_MODE_FLAG_NVSYNC
	.comm	_ADV7511_SYNC_POLARITY_PASSTHROUGH,8,3 ## @ADV7511_SYNC_POLARITY_PASSTHROUGH
	.comm	_ADV7511_LOW_REFRESH_RATE_24HZ,4,2 ## @ADV7511_LOW_REFRESH_RATE_24HZ
	.comm	_ADV7511_LOW_REFRESH_RATE_25HZ,4,2 ## @ADV7511_LOW_REFRESH_RATE_25HZ
	.comm	_ADV7511_LOW_REFRESH_RATE_30HZ,4,2 ## @ADV7511_LOW_REFRESH_RATE_30HZ
	.comm	_ADV7511_LOW_REFRESH_RATE_NONE,4,2 ## @ADV7511_LOW_REFRESH_RATE_NONE
	.comm	_ADV7533,8,3                    ## @ADV7533
	.no_dead_strip	_adv7511_mode_set
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function adv7511_mode_set
_adv7511_mode_set:                      ; @adv7511_mode_set
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
	ldr	x8, [x0, #32]
	cbz	x8, LBB0_2
; %bb.1:
	ldp	w8, w9, [x21]
	sub	w25, w8, w9
	ldp	w9, w10, [x21, #8]
	sub	w10, w9, w10
	ldp	w11, w12, [x21, #16]
	sub	w26, w11, w8
	sub	w23, w12, w9
	add	w24, w10, #1
	ldr	w0, [x19, #24]
Lloh0:
	adrp	x8, _ADV7511_REG_HSYNC_PLACEMENT_MSB@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ADV7511_REG_HSYNC_PLACEMENT_MSB@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	lsr	w8, w25, #5
	and	w2, w8, #0xe0
	bl	_regmap_write
	ldr	w22, [x19, #24]
	mov	w0, #0
	bl	_ADV7511_REG_SYNC_DECODER
	mov	x1, x0
	ubfx	w2, w25, #2, #8
	mov	x0, x22
	bl	_regmap_write
	ldr	w22, [x19, #24]
	mov	w0, #1
	bl	_ADV7511_REG_SYNC_DECODER
	mov	x1, x0
	ubfiz	w2, w25, #6, #2
	bfxil	w2, w26, #4, #6
	mov	x0, x22
	bl	_regmap_write
	ldr	w22, [x19, #24]
	mov	w0, #2
	bl	_ADV7511_REG_SYNC_DECODER
	mov	x1, x0
	ubfx	w2, w24, #6, #4
	bfi	w2, w26, #4, #4
	mov	x0, x22
	bl	_regmap_write
	ldr	w22, [x19, #24]
	mov	w0, #3
	bl	_ADV7511_REG_SYNC_DECODER
	mov	x1, x0
	ubfiz	w2, w24, #2, #6
	bfxil	w2, w23, #8, #2
	mov	x0, x22
	bl	_regmap_write
	ldr	w22, [x19, #24]
	mov	w0, #4
	bl	_ADV7511_REG_SYNC_DECODER
	mov	x1, x0
	and	w2, w23, #0xff
	mov	x0, x22
	bl	_regmap_write
	ldr	w8, [x21, #24]
Lloh3:
	adrp	x9, _DRM_MODE_FLAG_PHSYNC@GOTPAGE
Lloh4:
	ldr	x9, [x9, _DRM_MODE_FLAG_PHSYNC@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w22, eq
Lloh6:
	adrp	x9, _DRM_MODE_FLAG_PVSYNC@GOTPAGE
Lloh7:
	ldr	x9, [x9, _DRM_MODE_FLAG_PVSYNC@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w23, eq
	b	LBB0_3
LBB0_2:
	ldr	w8, [x21, #24]
Lloh9:
	adrp	x9, _DRM_MODE_FLAG_NHSYNC@GOTPAGE
Lloh10:
	ldr	x9, [x9, _DRM_MODE_FLAG_NHSYNC@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
Lloh12:
	adrp	x10, _ADV7511_SYNC_POLARITY_HIGH@GOTPAGE
Lloh13:
	ldr	x10, [x10, _ADV7511_SYNC_POLARITY_HIGH@GOTPAGEOFF]
Lloh14:
	ldr	w10, [x10]
Lloh15:
	adrp	x11, _ADV7511_SYNC_POLARITY_LOW@GOTPAGE
Lloh16:
	ldr	x11, [x11, _ADV7511_SYNC_POLARITY_LOW@GOTPAGEOFF]
Lloh17:
	ldr	w11, [x11]
	tst	w9, w8
	csel	w9, w10, w11, eq
Lloh18:
	adrp	x12, _DRM_MODE_FLAG_NVSYNC@GOTPAGE
Lloh19:
	ldr	x12, [x12, _DRM_MODE_FLAG_NVSYNC@GOTPAGEOFF]
Lloh20:
	ldr	w12, [x12]
	tst	w12, w8
	csel	w8, w10, w11, eq
	ldpsw	x10, x11, [x19]
	cmp	w10, w9
Lloh21:
	adrp	x9, _ADV7511_SYNC_POLARITY_PASSTHROUGH@GOTPAGE
Lloh22:
	ldr	x9, [x9, _ADV7511_SYNC_POLARITY_PASSTHROUGH@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	ccmp	x9, x10, #4, ne
	cset	w22, ne
	cmp	w11, w8
	ccmp	x9, x11, #4, ne
	cset	w23, ne
LBB0_3:
	mov	x0, x20
	bl	_drm_mode_vrefresh
	cmp	w0, #25
	b.ge	LBB0_5
; %bb.4:
Lloh24:
	adrp	x8, _ADV7511_LOW_REFRESH_RATE_24HZ@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ADV7511_LOW_REFRESH_RATE_24HZ@GOTPAGEOFF]
	b	LBB0_8
LBB0_5:
	mov	x0, x20
	bl	_drm_mode_vrefresh
	cmp	w0, #26
	b.ge	LBB0_7
; %bb.6:
Lloh26:
	adrp	x8, _ADV7511_LOW_REFRESH_RATE_25HZ@GOTPAGE
Lloh27:
	ldr	x8, [x8, _ADV7511_LOW_REFRESH_RATE_25HZ@GOTPAGEOFF]
	b	LBB0_8
LBB0_7:
	mov	x0, x20
	bl	_drm_mode_vrefresh
Lloh28:
	adrp	x8, _ADV7511_LOW_REFRESH_RATE_NONE@GOTPAGE
Lloh29:
	ldr	x8, [x8, _ADV7511_LOW_REFRESH_RATE_NONE@GOTPAGEOFF]
Lloh30:
	adrp	x9, _ADV7511_LOW_REFRESH_RATE_30HZ@GOTPAGE
Lloh31:
	ldr	x9, [x9, _ADV7511_LOW_REFRESH_RATE_30HZ@GOTPAGEOFF]
	cmp	w0, #31
	csel	x8, x9, x8, lt
LBB0_8:
	ldr	w8, [x8]
	ldr	w0, [x19, #24]
	lsl	w3, w8, #1
	mov	w1, #251
	mov	w2, #6
	bl	_regmap_update_bits
	ldr	w0, [x19, #24]
	mov	w8, #64
	cmp	w23, #0
	csel	w8, w8, wzr, ne
	mov	w9, #32
	cmp	w22, #0
	csel	w9, w9, wzr, ne
	orr	w3, w9, w8
	mov	w1, #23
	mov	w2, #96
	bl	_regmap_update_bits
	ldr	x8, [x19, #8]
Lloh32:
	adrp	x9, _ADV7533@GOTPAGE
Lloh33:
	ldr	x9, [x9, _ADV7533@GOTPAGEOFF]
Lloh34:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_10
; %bb.9:
	mov	x0, x19
	mov	x1, x21
	bl	_adv7533_mode_set
LBB0_10:
	add	x0, x19, #20
	mov	x1, x21
	bl	_drm_mode_copy
	ldr	w8, [x20, #28]
	str	w8, [x19, #16]
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.comm	_ADV7511_REG_HSYNC_PLACEMENT_MSB,4,2 ; @ADV7511_REG_HSYNC_PLACEMENT_MSB
	.comm	_DRM_MODE_FLAG_PHSYNC,4,2       ; @DRM_MODE_FLAG_PHSYNC
	.comm	_DRM_MODE_FLAG_PVSYNC,4,2       ; @DRM_MODE_FLAG_PVSYNC
	.comm	_DRM_MODE_FLAG_NHSYNC,4,2       ; @DRM_MODE_FLAG_NHSYNC
	.comm	_ADV7511_SYNC_POLARITY_LOW,4,2  ; @ADV7511_SYNC_POLARITY_LOW
	.comm	_ADV7511_SYNC_POLARITY_HIGH,4,2 ; @ADV7511_SYNC_POLARITY_HIGH
	.comm	_DRM_MODE_FLAG_NVSYNC,4,2       ; @DRM_MODE_FLAG_NVSYNC
	.comm	_ADV7511_SYNC_POLARITY_PASSTHROUGH,8,3 ; @ADV7511_SYNC_POLARITY_PASSTHROUGH
	.comm	_ADV7511_LOW_REFRESH_RATE_24HZ,4,2 ; @ADV7511_LOW_REFRESH_RATE_24HZ
	.comm	_ADV7511_LOW_REFRESH_RATE_25HZ,4,2 ; @ADV7511_LOW_REFRESH_RATE_25HZ
	.comm	_ADV7511_LOW_REFRESH_RATE_30HZ,4,2 ; @ADV7511_LOW_REFRESH_RATE_30HZ
	.comm	_ADV7511_LOW_REFRESH_RATE_NONE,4,2 ; @ADV7511_LOW_REFRESH_RATE_NONE
	.comm	_ADV7533,8,3                    ; @ADV7533
	.no_dead_strip	_adv7511_mode_set
.subsections_via_symbols
