	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tpg_calculate_square_border
_tpg_calculate_square_border:           ## @tpg_calculate_square_border
	.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
	movl	(%rdi), %r14d
	movl	4(%rdi), %r10d
	leal	(%r14,%r14), %ecx
	movl	$3435973837, %edx               ## imm = 0xCCCCCCCD
	imulq	%rcx, %rdx
	shrq	$34, %rdx
	andl	$-2, %edx
	movl	%r14d, %esi
	subl	%edx, %esi
	leal	2(%rdx), %ecx
	testb	$2, %sil
	cmovel	%edx, %ecx
	movl	%ecx, 40(%rdi)
	movl	8(%rdi), %esi
	movq	_TPG_VIDEO_ASPECT_16X9_ANAMORPHIC@GOTPCREL(%rip), %rax
	movl	%ecx, %edx
	cmpl	(%rax), %esi
	jne	LBB0_2
## %bb.1:
	movl	%ecx, %eax
	shrl	$2, %eax
	leal	(%rax,%rax,2), %ebx
	movl	%r14d, %edx
	subl	%ebx, %edx
	testb	$2, %dl
	leal	2(%rax,%rax,2), %edx
	cmovel	%ebx, %edx
	movl	%edx, 40(%rdi)
LBB0_2:
	movl	%r14d, %eax
	subl	%edx, %eax
	shrl	%eax
	movl	%eax, 44(%rdi)
	movq	16(%rdi), %rdx
	movq	_TPG_PIXEL_ASPECT_NTSC@GOTPCREL(%rip), %rax
	movq	(%rax), %r11
	cmpq	%r11, %rdx
	jne	LBB0_4
## %bb.3:
	addl	%ecx, %ecx
	leal	(%rcx,%rcx,4), %eax
	movl	$3123612579, %ecx               ## imm = 0xBA2E8BA3
	imulq	%rax, %rcx
	jmp	LBB0_6
LBB0_4:
	movq	_TPG_PIXEL_ASPECT_PAL@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdx
	jne	LBB0_7
## %bb.5:
	imull	$59, %ecx, %eax
	shrl	%eax
	imulq	$1272582903, %rax, %rcx         ## imm = 0x4BDA12F7
LBB0_6:
	shrq	$35, %rcx
LBB0_7:
	movl	%ecx, 48(%rdi)
	movl	%r10d, %eax
	subl	%ecx, %eax
	shrl	%eax
	movl	%eax, 52(%rdi)
	leaq	24(%rdi), %r9
	movl	$0, 24(%rdi)
	movl	%r14d, 28(%rdi)
	leaq	32(%rdi), %r8
	movl	$0, 32(%rdi)
	movl	%r10d, 36(%rdi)
	cmpl	$130, %esi
	je	LBB0_14
## %bb.8:
	cmpl	$129, %esi
	je	LBB0_21
## %bb.9:
	cmpl	$128, %esi
	jne	LBB0_29
## %bb.10:
	testq	%rdx, %rdx
	jne	LBB0_29
## %bb.11:
	leal	(%r14,%r14,2), %ecx
	leal	(,%r10,4), %edx
	cmpl	%edx, %ecx
	jae	LBB0_12
## %bb.13:
	shrl	$2, %ecx
	jmp	LBB0_25
LBB0_14:
	testq	%rdx, %rdx
	je	LBB0_17
## %bb.15:
	cmpq	%r11, %rdx
	movl	$420, %eax                      ## imm = 0x1A4
	movl	$506, %ecx                      ## imm = 0x1FA
	cmovel	%eax, %ecx
	jmp	LBB0_26
LBB0_21:
	testq	%rdx, %rdx
	je	LBB0_23
## %bb.22:
	cmpq	%r11, %rdx
	movl	$368, %eax                      ## imm = 0x170
	movl	$442, %ecx                      ## imm = 0x1BA
	cmovel	%eax, %ecx
	jmp	LBB0_26
LBB0_17:
	leal	(%r14,%r14,8), %ecx
	movl	%r10d, %edx
	shll	$4, %edx
	subl	%r10d, %edx
	subl	%r10d, %edx
	cmpl	%edx, %ecx
	jae	LBB0_18
## %bb.20:
	shrl	%ecx
	movl	$2454267027, %eax               ## imm = 0x92492493
	imulq	%rcx, %rax
	shrq	$34, %rax
	andl	$-2, %eax
	movl	%eax, 36(%rdi)
	subl	%eax, %r10d
	jmp	LBB0_27
LBB0_23:
	leal	(%r14,%r14,8), %ecx
	movl	%r10d, %edx
	shll	$4, %edx
	cmpl	%edx, %ecx
	jae	LBB0_18
## %bb.24:
	shrl	$4, %ecx
LBB0_25:
	andl	$-2, %ecx
LBB0_26:
	movl	%ecx, 36(%rdi)
	subl	%ecx, %r10d
LBB0_27:
	movl	%r10d, %r14d
	movq	%r8, %r9
	jmp	LBB0_28
LBB0_18:
	movl	%edx, %eax
	imulq	$954437177, %rax, %rax          ## imm = 0x38E38E39
	shrq	$33, %rax
	andl	$-2, %eax
	movl	%r14d, %ecx
	subl	%eax, %ecx
	leal	-2(%rax), %edx
	cmpl	$4, %ecx
	cmovbl	%eax, %edx
	jmp	LBB0_19
LBB0_12:
	movl	%edx, %eax
	movl	$2863311531, %ecx               ## imm = 0xAAAAAAAB
	imulq	%rax, %rcx
	shrq	$33, %rcx
	andl	$-2, %ecx
	movl	%r14d, %eax
	subl	%ecx, %eax
	leal	-2(%rcx), %edx
	cmpl	$4, %eax
	cmovbl	%ecx, %edx
LBB0_19:
	movl	%edx, 28(%rdi)
	subl	%edx, %r14d
LBB0_28:
	shrl	%r14d
	movl	%r14d, (%r9)
LBB0_29:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_TPG_VIDEO_ASPECT_16X9_ANAMORPHIC,4,2 ## @TPG_VIDEO_ASPECT_16X9_ANAMORPHIC
	.comm	_TPG_PIXEL_ASPECT_NTSC,8,3      ## @TPG_PIXEL_ASPECT_NTSC
	.comm	_TPG_PIXEL_ASPECT_PAL,8,3       ## @TPG_PIXEL_ASPECT_PAL
	.no_dead_strip	_tpg_calculate_square_border
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tpg_calculate_square_border
_tpg_calculate_square_border:           ; @tpg_calculate_square_border
	.cfi_startproc
; %bb.0:
	ldp	w8, w9, [x0]
	lsl	w10, w8, #1
	mov	w11, #52429
	movk	w11, #52428, lsl #16
	umull	x10, w10, w11
	lsr	x10, x10, #34
	and	w10, w10, #0x3ffffffe
	sub	w11, w8, w10
	add	w12, w10, #2
	tst	w11, #0x2
	csel	w11, w10, w12, eq
	str	w11, [x0, #40]
	ldr	w12, [x0, #8]
Lloh0:
	adrp	x10, _TPG_VIDEO_ASPECT_16X9_ANAMORPHIC@GOTPAGE
Lloh1:
	ldr	x10, [x10, _TPG_VIDEO_ASPECT_16X9_ANAMORPHIC@GOTPAGEOFF]
Lloh2:
	ldr	w13, [x10]
	mov	x10, x11
	cmp	w12, w13
	b.ne	LBB0_2
; %bb.1:
	lsr	w10, w11, #2
	add	w10, w10, w10, lsl #1
	sub	w13, w8, w10
	add	w14, w10, #2
	tst	w13, #0x2
	csel	w10, w10, w14, eq
	str	w10, [x0, #40]
LBB0_2:
	sub	w10, w8, w10
	lsr	w10, w10, #1
	str	w10, [x0, #44]
	ldr	x13, [x0, #16]
Lloh3:
	adrp	x10, _TPG_PIXEL_ASPECT_NTSC@GOTPAGE
Lloh4:
	ldr	x10, [x10, _TPG_PIXEL_ASPECT_NTSC@GOTPAGEOFF]
Lloh5:
	ldr	x14, [x10]
	cmp	x13, x14
	b.ne	LBB0_4
; %bb.3:
	add	w10, w11, w11, lsl #2
	lsl	w10, w10, #1
	mov	w11, #35747
	movk	w11, #47662, lsl #16
	umull	x10, w10, w11
	lsr	x11, x10, #35
	b	LBB0_6
LBB0_4:
Lloh6:
	adrp	x10, _TPG_PIXEL_ASPECT_PAL@GOTPAGE
Lloh7:
	ldr	x10, [x10, _TPG_PIXEL_ASPECT_PAL@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
	cmp	x13, x10
	b.ne	LBB0_6
; %bb.5:
	mov	w10, #59
	mul	w10, w11, w10
	lsr	w10, w10, #1
	mov	w11, #4855
	movk	w11, #19418, lsl #16
	umull	x10, w10, w11
	lsr	x11, x10, #35
                                        ; kill: def $w11 killed $w11 killed $x11 def $x11
LBB0_6:
	mov	x10, x0
	str	wzr, [x10, #24]!
	sub	w15, w9, w11
	lsr	w15, w15, #1
	stp	w11, w15, [x10, #24]
	str	w8, [x10, #4]
	mov	x11, x10
	str	wzr, [x11, #8]!
	str	w9, [x10, #12]
	cmp	w12, #130
	b.eq	LBB0_11
; %bb.7:
	cmp	w12, #129
	b.eq	LBB0_13
; %bb.8:
	cmp	w12, #128
	b.ne	LBB0_10
; %bb.9:
	cbz	x13, LBB0_15
LBB0_10:
	ret
LBB0_11:
	cbz	x13, LBB0_17
; %bb.12:
	cmp	x13, x14
	mov	w8, #506
	mov	w10, #420
	csel	w8, w10, w8, eq
	b	LBB0_21
LBB0_13:
	cbz	x13, LBB0_19
; %bb.14:
	cmp	x13, x14
	mov	w8, #442
	mov	w10, #368
	csel	w8, w10, w8, eq
	b	LBB0_21
LBB0_15:
	add	w12, w8, w8, lsl #1
	lsl	w13, w9, #2
	cmp	w12, w13
	b.hs	LBB0_23
; %bb.16:
	lsr	w8, w12, #2
	and	w8, w8, #0x3ffffffe
	b	LBB0_21
LBB0_17:
	add	w12, w8, w8, lsl #3
	mov	w13, #14
	mul	w13, w9, w13
	cmp	w12, w13
	b.hs	LBB0_22
; %bb.18:
	lsr	w8, w12, #1
	mov	w10, #9363
	movk	w10, #37449, lsl #16
	umull	x8, w8, w10
	lsr	x8, x8, #34
	and	w8, w8, #0x1ffffffe
	b	LBB0_21
LBB0_19:
	add	w12, w8, w8, lsl #3
	lsl	w13, w9, #4
	cmp	w12, w13
	b.hs	LBB0_22
; %bb.20:
	lsr	w8, w12, #4
	and	w8, w8, #0xffffffe
LBB0_21:
	str	w8, [x0, #36]
	sub	w8, w9, w8
	mov	x10, x11
	b	LBB0_25
LBB0_22:
	mov	w9, #36409
	movk	w9, #14563, lsl #16
	umull	x9, w13, w9
	lsr	x9, x9, #33
	and	w9, w9, #0x1ffffffe
	b	LBB0_24
LBB0_23:
	mov	w9, #43691
	movk	w9, #43690, lsl #16
	umull	x9, w13, w9
	lsr	x9, x9, #33
	and	w9, w9, #0x7ffffffe
LBB0_24:
	sub	w11, w8, w9
	sub	w12, w9, #2
	cmp	w11, #4
	csel	w9, w9, w12, lo
	str	w9, [x0, #28]
	sub	w8, w8, w9
LBB0_25:
	lsr	w8, w8, #1
	str	w8, [x10]
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_TPG_VIDEO_ASPECT_16X9_ANAMORPHIC,4,2 ; @TPG_VIDEO_ASPECT_16X9_ANAMORPHIC
	.comm	_TPG_PIXEL_ASPECT_NTSC,8,3      ; @TPG_PIXEL_ASPECT_NTSC
	.comm	_TPG_PIXEL_ASPECT_PAL,8,3       ; @TPG_PIXEL_ASPECT_PAL
	.no_dead_strip	_tpg_calculate_square_border
.subsections_via_symbols
