	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vc4_plane_margins_adj
_vc4_plane_margins_adj:                 ## @vc4_plane_margins_adj
	.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	%rdi, %rbx
	callq	_to_vc4_plane_state
	movq	%rax, %r14
	movl	(%rbx), %esi
	movl	4(%rbx), %edi
	callq	_drm_atomic_get_new_crtc_state
	movq	%rax, %rbx
	leaq	-52(%rbp), %rsi
	leaq	-56(%rbp), %rdx
	leaq	-44(%rbp), %rcx
	leaq	-48(%rbp), %r8
	movq	%rax, %rdi
	callq	_vc4_crtc_get_margins
	movl	-52(%rbp), %edx
	xorl	%r15d, %r15d
	movl	-56(%rbp), %edi
	movl	-44(%rbp), %eax
	movl	-48(%rbp), %ecx
	testl	%edx, %edx
	jne	LBB0_4
## %bb.1:
	testl	%edi, %edi
	jne	LBB0_4
## %bb.2:
	testl	%eax, %eax
	jne	LBB0_4
## %bb.3:
	testl	%ecx, %ecx
	je	LBB0_9
LBB0_4:
	addl	%edx, %edi
	movl	(%rbx), %esi
	movl	%esi, %r12d
	subl	%edi, %r12d
	jbe	LBB0_8
## %bb.5:
	addl	%eax, %ecx
	cmpl	4(%rbx), %ecx
	jae	LBB0_8
## %bb.6:
	movl	(%r14), %edi
	imull	%r12d, %edi
	callq	_DIV_ROUND_CLOSEST
	movl	-52(%rbp), %ecx
	addl	%ecx, %eax
	movl	(%rbx), %edx
	subl	%ecx, %edx
	cmpl	%edx, %eax
	cmovbl	%eax, %edx
	movl	%edx, (%r14)
	movl	-44(%rbp), %eax
	addl	-48(%rbp), %eax
	movl	4(%rbx), %esi
	movl	%esi, %r13d
	subl	%eax, %r13d
	movl	4(%r14), %edi
	imull	%r13d, %edi
	callq	_DIV_ROUND_CLOSEST
	movl	-44(%rbp), %ecx
	addl	%ecx, %eax
	movl	4(%rbx), %edx
	subl	%ecx, %edx
	cmpl	%edx, %eax
	cmovbl	%eax, %edx
	movl	%edx, 4(%r14)
	imull	8(%r14), %r12d
	movl	(%rbx), %esi
	movl	%r12d, %edi
	callq	_DIV_ROUND_CLOSEST
	movl	%eax, 8(%r14)
	imull	12(%r14), %r13d
	movl	4(%rbx), %esi
	movl	%r13d, %edi
	callq	_DIV_ROUND_CLOSEST
	movl	%eax, 12(%r14)
	cmpl	$0, 8(%r14)
	je	LBB0_8
## %bb.7:
	testl	%eax, %eax
	jne	LBB0_9
LBB0_8:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_9:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_vc4_plane_margins_adj
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vc4_plane_margins_adj
_vc4_plane_margins_adj:                 ; @vc4_plane_margins_adj
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x20, x0
	bl	_to_vc4_plane_state
	mov	x19, x0
	ldp	w1, w0, [x20]
	bl	_drm_atomic_get_new_crtc_state
	mov	x20, x0
	add	x1, sp, #12
	add	x2, sp, #8
	add	x3, sp, #4
	mov	x4, sp
	bl	_vc4_crtc_get_margins
	ldp	w11, w10, [sp, #8]
	ldp	w9, w8, [sp]
	cmp	w10, #0
	ccmp	w11, #0, #0, eq
	ccmp	w8, #0, #0, eq
	ccmp	w9, #0, #0, eq
	b.eq	LBB0_5
; %bb.1:
	ldr	w1, [x20]
	add	w10, w11, w10
	subs	w21, w1, w10
	b.ls	LBB0_6
; %bb.2:
	ldr	w10, [x20, #4]
	add	w8, w9, w8
	cmp	w8, w10
	b.hs	LBB0_6
; %bb.3:
	ldr	w8, [x19]
	mul	w0, w8, w21
	bl	_DIV_ROUND_CLOSEST
	ldr	w8, [sp, #12]
	add	w9, w8, w0
	ldr	w10, [x20]
	sub	w8, w10, w8
	cmp	w9, w8
	csel	w8, w9, w8, lo
	str	w8, [x19]
	ldr	w1, [x20, #4]
	ldp	w9, w8, [sp]
	add	w8, w8, w9
	sub	w22, w1, w8
	ldr	w8, [x19, #4]
	mul	w0, w8, w22
	bl	_DIV_ROUND_CLOSEST
	ldr	w8, [sp, #4]
	add	w9, w8, w0
	ldr	w10, [x20, #4]
	sub	w8, w10, w8
	cmp	w9, w8
	csel	w8, w9, w8, lo
	str	w8, [x19, #4]
	ldr	w8, [x19, #8]
	mul	w0, w8, w21
	ldr	w1, [x20]
	bl	_DIV_ROUND_CLOSEST
	str	w0, [x19, #8]
	ldr	w8, [x19, #12]
	mul	w0, w8, w22
	ldr	w1, [x20, #4]
	bl	_DIV_ROUND_CLOSEST
	str	w0, [x19, #12]
	ldr	w8, [x19, #8]
	cbz	w8, LBB0_6
; %bb.4:
	cbz	w0, LBB0_6
LBB0_5:
	mov	w0, #0
	b	LBB0_7
LBB0_6:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_7:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_vc4_plane_margins_adj
.subsections_via_symbols
