	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function saa7146_set_winsize
_saa7146_set_winsize:                   ## @saa7146_set_winsize
	.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, %r15
	cmpl	$15, 4(%rdi)
	movq	_palette2fmt@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	jne	LBB0_2
## %bb.1:
	movl	8(%r15), %eax
	movq	_VIDEO_PALETTE_RGB555@GOTPCREL(%rip), %rdx
	jmp	LBB0_3
LBB0_2:
	movq	_bpp2fmt@GOTPCREL(%rip), %rsi
	movl	8(%r15), %eax
	leal	-1(%rax), %edx
	andl	$3, %edx
	shlq	$3, %rdx
	addq	(%rsi), %rdx
LBB0_3:
	movq	(%rdx), %rdx
	movl	(%rcx,%rdx,4), %r14d
	movl	%r14d, (%r15)
	imull	12(%r15), %eax
	movl	20(%r15), %ebx
	imull	16(%r15), %ebx
	addl	%eax, %ebx
	movl	24(%r15), %edi
	addl	%ebx, %edi
	movq	_SAA7146_BASE_EVEN1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_saawrite
	addl	24(%r15), %ebx
	addl	20(%r15), %ebx
	movq	_SAA7146_BASE_ODD1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_saawrite
	movl	20(%r15), %edi
	addl	%edi, %edi
	movq	_SAA7146_PITCH1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_saawrite
	movl	28(%r15), %edi
	imull	20(%r15), %edi
	addl	24(%r15), %edi
	movq	_SAA7146_PROT_ADDR1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_saawrite
	movq	_SAA7146_PAGE1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edi, %edi
	callq	_saawrite
	orl	$96, %r14d
	movq	_SAA7146_CLIP_FORMAT_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	callq	_saawrite
	movl	32(%r15), %ecx
	decl	%ecx
	movl	$704, %eax                      ## imm = 0x2C0
	xorl	%edx, %edx
	idivl	%ecx
	movl	%eax, %ebx
	andl	$63, %ebx
	movq	_h_prescale@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax,%rbx,4), %edi
	movq	_SAA7146_HPS_H_PRESCALE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_saawrite
	movl	$720896, %eax                   ## imm = 0xB0000
	xorl	%edx, %edx
	idivl	32(%r15)
	incl	%ebx
	cltd
	idivl	%ebx
                                        ## kill: def $eax killed $eax def $rax
	shll	$12, %eax
	leal	12(%rax), %edi
	movq	_SAA7146_HPS_H_SCALE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_saawrite
	movq	_CurrentMode@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	_VIDEO_MODE_NTSC@GOTPCREL(%rip), %rdx
	movl	36(%r15), %eax
	shll	$10, %eax
	cmpq	(%rdx), %rcx
	movl	$-480, %ecx                     ## imm = 0xFE20
	movl	$-576, %esi                     ## imm = 0xFDC0
	cmovel	%ecx, %esi
	cltd
	idivl	%esi
	shll	$21, %eax
	orl	$-2147483648, %eax              ## imm = 0x80000000
	movq	_SAA7146_HPS_V_SCALE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%eax, %edi
	callq	_saawrite
	movq	_v_gain@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %edi
	movq	_SAA7146_HPS_V_GAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_saawrite
	movq	_SAA7146_MC2_UPLD_DMA1@GOTPCREL(%rip), %rax
	movq	_SAA7146_MC2_UPLD_HPS_V@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	_SAA7146_MC2_UPLD_HPS_H@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, %edi
	shll	$16, %edi
	orl	%ecx, %edi
	movq	_SAA7146_MC2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_saawrite                       ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_palette2fmt,8,3                ## @palette2fmt
	.comm	_VIDEO_PALETTE_RGB555,8,3       ## @VIDEO_PALETTE_RGB555
	.comm	_bpp2fmt,8,3                    ## @bpp2fmt
	.comm	_SAA7146_BASE_EVEN1,4,2         ## @SAA7146_BASE_EVEN1
	.comm	_SAA7146_BASE_ODD1,4,2          ## @SAA7146_BASE_ODD1
	.comm	_SAA7146_PITCH1,4,2             ## @SAA7146_PITCH1
	.comm	_SAA7146_PROT_ADDR1,4,2         ## @SAA7146_PROT_ADDR1
	.comm	_SAA7146_PAGE1,4,2              ## @SAA7146_PAGE1
	.comm	_SAA7146_CLIP_FORMAT_CTRL,4,2   ## @SAA7146_CLIP_FORMAT_CTRL
	.comm	_h_prescale,8,3                 ## @h_prescale
	.comm	_SAA7146_HPS_H_PRESCALE,4,2     ## @SAA7146_HPS_H_PRESCALE
	.comm	_SAA7146_HPS_H_SCALE,4,2        ## @SAA7146_HPS_H_SCALE
	.comm	_CurrentMode,8,3                ## @CurrentMode
	.comm	_VIDEO_MODE_NTSC,8,3            ## @VIDEO_MODE_NTSC
	.comm	_SAA7146_HPS_V_SCALE,4,2        ## @SAA7146_HPS_V_SCALE
	.comm	_v_gain,8,3                     ## @v_gain
	.comm	_SAA7146_HPS_V_GAIN,4,2         ## @SAA7146_HPS_V_GAIN
	.comm	_SAA7146_MC2_UPLD_DMA1,4,2      ## @SAA7146_MC2_UPLD_DMA1
	.comm	_SAA7146_MC2_UPLD_HPS_V,4,2     ## @SAA7146_MC2_UPLD_HPS_V
	.comm	_SAA7146_MC2_UPLD_HPS_H,4,2     ## @SAA7146_MC2_UPLD_HPS_H
	.comm	_SAA7146_MC2,4,2                ## @SAA7146_MC2
	.no_dead_strip	_saa7146_set_winsize
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function saa7146_set_winsize
_saa7146_set_winsize:                   ; @saa7146_set_winsize
	.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	w9, [x0, #4]
Lloh0:
	adrp	x8, _palette2fmt@GOTPAGE
Lloh1:
	ldr	x8, [x8, _palette2fmt@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	w9, #15
	b.ne	LBB0_2
; %bb.1:
	ldr	w9, [x19, #8]
Lloh3:
	adrp	x10, _VIDEO_PALETTE_RGB555@GOTPAGE
Lloh4:
	ldr	x10, [x10, _VIDEO_PALETTE_RGB555@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:
Lloh5:
	adrp	x9, _bpp2fmt@GOTPAGE
Lloh6:
	ldr	x9, [x9, _bpp2fmt@GOTPAGEOFF]
Lloh7:
	ldr	x10, [x9]
	ldr	w9, [x19, #8]
	sub	w11, w9, #1
	and	w11, w11, #0x3
	add	x10, x10, w11, uxtw #3
LBB0_3:
	ldr	x10, [x10]
	ldr	w20, [x8, x10, lsl #2]
	str	w20, [x19]
	ldp	w8, w10, [x19, #12]
	mul	w8, w9, w8
	ldp	w9, w11, [x19, #20]
	madd	w21, w9, w10, w8
	add	w0, w21, w11
Lloh8:
	adrp	x8, _SAA7146_BASE_EVEN1@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SAA7146_BASE_EVEN1@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	bl	_saawrite
	ldp	w9, w8, [x19, #20]
	add	w8, w8, w21
	add	w0, w8, w9
Lloh11:
	adrp	x8, _SAA7146_BASE_ODD1@GOTPAGE
Lloh12:
	ldr	x8, [x8, _SAA7146_BASE_ODD1@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	bl	_saawrite
	ldr	w8, [x19, #20]
	lsl	w0, w8, #1
Lloh14:
	adrp	x8, _SAA7146_PITCH1@GOTPAGE
Lloh15:
	ldr	x8, [x8, _SAA7146_PITCH1@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	bl	_saawrite
	ldp	w9, w8, [x19, #20]
	ldr	w10, [x19, #28]
	madd	w0, w10, w9, w8
Lloh17:
	adrp	x8, _SAA7146_PROT_ADDR1@GOTPAGE
Lloh18:
	ldr	x8, [x8, _SAA7146_PROT_ADDR1@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	bl	_saawrite
Lloh20:
	adrp	x8, _SAA7146_PAGE1@GOTPAGE
Lloh21:
	ldr	x8, [x8, _SAA7146_PAGE1@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	mov	w0, #0
	bl	_saawrite
	orr	w0, w20, #0x60
Lloh23:
	adrp	x8, _SAA7146_CLIP_FORMAT_CTRL@GOTPAGE
Lloh24:
	ldr	x8, [x8, _SAA7146_CLIP_FORMAT_CTRL@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	bl	_saawrite
	ldr	w8, [x19, #32]
	sub	w8, w8, #1
	mov	w9, #704
	sdiv	w8, w9, w8
	and	w20, w8, #0x3f
Lloh26:
	adrp	x8, _h_prescale@GOTPAGE
Lloh27:
	ldr	x8, [x8, _h_prescale@GOTPAGEOFF]
Lloh28:
	ldr	x8, [x8]
	ldr	w0, [x8, w20, uxtw #2]
Lloh29:
	adrp	x8, _SAA7146_HPS_H_PRESCALE@GOTPAGE
Lloh30:
	ldr	x8, [x8, _SAA7146_HPS_H_PRESCALE@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	bl	_saawrite
	ldr	w8, [x19, #32]
	mov	w9, #720896
	sdiv	w8, w9, w8
	add	w9, w20, #1
	sdiv	w8, w8, w9
	mov	w0, #12
	bfi	w0, w8, #12, #20
Lloh32:
	adrp	x8, _SAA7146_HPS_H_SCALE@GOTPAGE
Lloh33:
	ldr	x8, [x8, _SAA7146_HPS_H_SCALE@GOTPAGEOFF]
Lloh34:
	ldr	w1, [x8]
	bl	_saawrite
Lloh35:
	adrp	x8, _CurrentMode@GOTPAGE
Lloh36:
	ldr	x8, [x8, _CurrentMode@GOTPAGEOFF]
Lloh37:
	ldr	x8, [x8]
Lloh38:
	adrp	x9, _VIDEO_MODE_NTSC@GOTPAGE
Lloh39:
	ldr	x9, [x9, _VIDEO_MODE_NTSC@GOTPAGEOFF]
Lloh40:
	ldr	x9, [x9]
	ldr	w10, [x19, #36]
	lsl	w10, w10, #10
	cmp	x8, x9
	mov	w8, #-576
	mov	w9, #-480
	csel	w8, w9, w8, eq
	sdiv	w8, w10, w8
	lsl	w8, w8, #21
	orr	w0, w8, #0x80000000
Lloh41:
	adrp	x8, _SAA7146_HPS_V_SCALE@GOTPAGE
Lloh42:
	ldr	x8, [x8, _SAA7146_HPS_V_SCALE@GOTPAGEOFF]
Lloh43:
	ldr	w1, [x8]
	bl	_saawrite
Lloh44:
	adrp	x8, _v_gain@GOTPAGE
Lloh45:
	ldr	x8, [x8, _v_gain@GOTPAGEOFF]
Lloh46:
	ldr	x8, [x8]
	ldr	w0, [x8]
Lloh47:
	adrp	x8, _SAA7146_HPS_V_GAIN@GOTPAGE
Lloh48:
	ldr	x8, [x8, _SAA7146_HPS_V_GAIN@GOTPAGEOFF]
Lloh49:
	ldr	w1, [x8]
	bl	_saawrite
Lloh50:
	adrp	x8, _SAA7146_MC2_UPLD_DMA1@GOTPAGE
Lloh51:
	ldr	x8, [x8, _SAA7146_MC2_UPLD_DMA1@GOTPAGEOFF]
Lloh52:
	ldr	w8, [x8]
Lloh53:
	adrp	x9, _SAA7146_MC2_UPLD_HPS_V@GOTPAGE
Lloh54:
	ldr	x9, [x9, _SAA7146_MC2_UPLD_HPS_V@GOTPAGEOFF]
Lloh55:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh56:
	adrp	x9, _SAA7146_MC2_UPLD_HPS_H@GOTPAGE
Lloh57:
	ldr	x9, [x9, _SAA7146_MC2_UPLD_HPS_H@GOTPAGEOFF]
Lloh58:
	ldr	w9, [x9]
	orr	w8, w8, w9
	orr	w0, w8, w8, lsl #16
Lloh59:
	adrp	x8, _SAA7146_MC2@GOTPAGE
Lloh60:
	ldr	x8, [x8, _SAA7146_MC2@GOTPAGEOFF]
Lloh61:
	ldr	w1, [x8]
	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
	b	_saawrite
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh59, Lloh60, Lloh61
	.loh AdrpLdrGotLdr	Lloh56, Lloh57, Lloh58
	.loh AdrpLdrGotLdr	Lloh53, Lloh54, Lloh55
	.loh AdrpLdrGotLdr	Lloh50, Lloh51, Lloh52
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_palette2fmt,8,3                ; @palette2fmt
	.comm	_VIDEO_PALETTE_RGB555,8,3       ; @VIDEO_PALETTE_RGB555
	.comm	_bpp2fmt,8,3                    ; @bpp2fmt
	.comm	_SAA7146_BASE_EVEN1,4,2         ; @SAA7146_BASE_EVEN1
	.comm	_SAA7146_BASE_ODD1,4,2          ; @SAA7146_BASE_ODD1
	.comm	_SAA7146_PITCH1,4,2             ; @SAA7146_PITCH1
	.comm	_SAA7146_PROT_ADDR1,4,2         ; @SAA7146_PROT_ADDR1
	.comm	_SAA7146_PAGE1,4,2              ; @SAA7146_PAGE1
	.comm	_SAA7146_CLIP_FORMAT_CTRL,4,2   ; @SAA7146_CLIP_FORMAT_CTRL
	.comm	_h_prescale,8,3                 ; @h_prescale
	.comm	_SAA7146_HPS_H_PRESCALE,4,2     ; @SAA7146_HPS_H_PRESCALE
	.comm	_SAA7146_HPS_H_SCALE,4,2        ; @SAA7146_HPS_H_SCALE
	.comm	_CurrentMode,8,3                ; @CurrentMode
	.comm	_VIDEO_MODE_NTSC,8,3            ; @VIDEO_MODE_NTSC
	.comm	_SAA7146_HPS_V_SCALE,4,2        ; @SAA7146_HPS_V_SCALE
	.comm	_v_gain,8,3                     ; @v_gain
	.comm	_SAA7146_HPS_V_GAIN,4,2         ; @SAA7146_HPS_V_GAIN
	.comm	_SAA7146_MC2_UPLD_DMA1,4,2      ; @SAA7146_MC2_UPLD_DMA1
	.comm	_SAA7146_MC2_UPLD_HPS_V,4,2     ; @SAA7146_MC2_UPLD_HPS_V
	.comm	_SAA7146_MC2_UPLD_HPS_H,4,2     ; @SAA7146_MC2_UPLD_HPS_H
	.comm	_SAA7146_MC2,4,2                ; @SAA7146_MC2
	.no_dead_strip	_saa7146_set_winsize
.subsections_via_symbols
