	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mx3_videobuf_setup
_mx3_videobuf_setup:                    ## @mx3_videobuf_setup
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rsi, %r14
	movq	(%rdi), %rbx
	movl	16(%rbx), %edi
	callq	_to_soc_camera_host
	movq	(%rax), %r12
	movq	8(%rbx), %rax
	movl	(%rax), %edi
	movl	$8, %esi
	callq	_DIV_ROUND_UP
	movl	%eax, %ecx
	movq	(%r12), %rax
	cmpl	$0, (%rax)
	je	LBB0_1
## %bb.2:
	imull	(%rbx), %ecx
	imull	4(%rbx), %ecx
	movl	%ecx, (%r15)
	movl	(%r14), %edx
	testl	%edx, %edx
	jne	LBB0_4
## %bb.3:
	movl	$32, (%r14)
	movl	(%r15), %ecx
	movl	$32, %edx
LBB0_4:
	imull	%ecx, %edx
	movq	_MAX_VIDEO_MEM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shll	$20, %eax
	xorl	%esi, %esi
	cmpl	%eax, %edx
	jbe	LBB0_6
## %bb.5:
	xorl	%esi, %esi
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, (%r14)
	jmp	LBB0_6
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%esi, %esi
	subl	(%rax), %esi
LBB0_6:
	movl	%esi, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MAX_VIDEO_MEM,4,2              ## @MAX_VIDEO_MEM
	.no_dead_strip	_mx3_videobuf_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mx3_videobuf_setup
_mx3_videobuf_setup:                    ; @mx3_videobuf_setup
	.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	x20, x2
	mov	x19, x1
	ldr	x21, [x0]
	ldr	w0, [x21, #16]
	bl	_to_soc_camera_host
	ldr	x22, [x0]
	ldr	x8, [x21, #8]
	ldr	w0, [x8]
	mov	w1, #8
	bl	_DIV_ROUND_UP
	ldr	x8, [x22]
	ldr	w8, [x8]
	cbz	w8, LBB0_5
; %bb.1:
	ldp	w8, w9, [x21]
	mul	w8, w8, w0
	mul	w8, w8, w9
	str	w8, [x20]
	ldr	w9, [x19]
	cbnz	w9, LBB0_3
; %bb.2:
	mov	w9, #32
	str	w9, [x19]
	ldr	w8, [x20]
LBB0_3:
	mul	w10, w9, w8
Lloh0:
	adrp	x9, _MAX_VIDEO_MEM@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MAX_VIDEO_MEM@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	lsl	w9, w9, #20
	cmp	w10, w9
	b.ls	LBB0_6
; %bb.4:
	mov	w0, #0
	udiv	w8, w9, w8
	str	w8, [x19]
	b	LBB0_7
LBB0_5:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_7
LBB0_6:
	mov	w0, #0
LBB0_7:
	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
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MAX_VIDEO_MEM,4,2              ; @MAX_VIDEO_MEM
	.no_dead_strip	_mx3_videobuf_setup
.subsections_via_symbols
