	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cobalt_try_fmt_vid_cap
_cobalt_try_fmt_vid_cap:                ## @cobalt_try_fmt_vid_cap
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdx, %rbx
	callq	_video_drvdata
	movl	(%rbx), %ecx
	movl	$176, %edx
	movl	$144, %edi
	cmpl	$176, %ecx
	jl	LBB0_3
## %bb.1:
	movl	4(%rbx), %esi
	cmpl	$144, %esi
	jl	LBB0_3
## %bb.2:
	cmpl	$1921, %ecx                     ## imm = 0x781
	setae	%dil
	cmpl	$1081, %esi                     ## imm = 0x439
	setae	%dl
	orb	%dil, %dl
	andl	$-4, %ecx
	andl	$-2, %esi
	testb	%dl, %dl
	movl	$1920, %edx                     ## imm = 0x780
	cmovel	%ecx, %edx
	movl	$1080, %edi                     ## imm = 0x438
	cmovel	%esi, %edi
LBB0_3:
	movl	%edx, (%rbx)
	movl	%edi, 4(%rbx)
	cmpl	$1, (%rax)
	jne	LBB0_5
## %bb.4:
	movabsq	$4638564681600, %rax            ## imm = 0x43800000780
	movq	%rax, (%rbx)
	movq	_V4L2_COLORSPACE_SRGB@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%rbx)
	jmp	LBB0_6
LBB0_5:
	movl	8(%rax), %ecx
	movl	%ecx, -24(%rbp)
	movq	_V4L2_SUBDEV_FORMAT_ACTIVE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -28(%rbp)
	movl	4(%rax), %edi
	movq	_pad@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_get_fmt@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-32(%rbp), %r14
	xorl	%ecx, %ecx
	movq	%r14, %r8
	callq	_v4l2_subdev_call
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_v4l2_fill_pix_format
LBB0_6:
	movl	8(%rbx), %eax
	cmpl	$129, %eax
	je	LBB0_9
## %bb.7:
	cmpl	$130, %eax
	jne	LBB0_8
## %bb.10:
	movl	12(%rbx), %edi
	andl	$-4, %edi
	movq	_COBALT_BYTES_PER_PIXEL_RGB32@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_9:
	movl	12(%rbx), %edi
	andl	$-4, %edi
	movq	_COBALT_BYTES_PER_PIXEL_RGB24@GOTPCREL(%rip), %rax
LBB0_11:
	movl	(%rax), %esi
	imull	(%rbx), %esi
	callq	_max
	movl	%eax, 12(%rbx)
	jmp	LBB0_12
LBB0_8:
	movl	12(%rbx), %edi
	andl	$-4, %edi
	movq	_COBALT_BYTES_PER_PIXEL_YUYV@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	imull	(%rbx), %esi
	callq	_max
	movl	%eax, 12(%rbx)
	movl	$128, 8(%rbx)
LBB0_12:
	imull	4(%rbx), %eax
	movl	%eax, 16(%rbx)
	movq	_V4L2_FIELD_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%rbx)
	xorl	%eax, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_V4L2_COLORSPACE_SRGB,4,2       ## @V4L2_COLORSPACE_SRGB
	.comm	_V4L2_SUBDEV_FORMAT_ACTIVE,4,2  ## @V4L2_SUBDEV_FORMAT_ACTIVE
	.comm	_pad,4,2                        ## @pad
	.comm	_get_fmt,4,2                    ## @get_fmt
	.comm	_COBALT_BYTES_PER_PIXEL_YUYV,4,2 ## @COBALT_BYTES_PER_PIXEL_YUYV
	.comm	_COBALT_BYTES_PER_PIXEL_RGB24,4,2 ## @COBALT_BYTES_PER_PIXEL_RGB24
	.comm	_COBALT_BYTES_PER_PIXEL_RGB32,4,2 ## @COBALT_BYTES_PER_PIXEL_RGB32
	.comm	_V4L2_FIELD_NONE,4,2            ## @V4L2_FIELD_NONE
	.no_dead_strip	_cobalt_try_fmt_vid_cap
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function cobalt_try_fmt_vid_cap
lCPI0_0:
	.long	1920                            ; 0x780
	.long	1080                            ; 0x438
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_cobalt_try_fmt_vid_cap:                ; @cobalt_try_fmt_vid_cap
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x19, x2
	bl	_video_drvdata
	ldr	w8, [x19]
	cmp	w8, #176
	b.ge	LBB0_2
; %bb.1:
	mov	w9, #176
	mov	w8, #144
	b	LBB0_3
LBB0_2:
	ldr	w9, [x19, #4]
	mov	w10, #176
	mov	w11, #144
	cmp	w8, #1920
	mov	w12, #1080
	ccmp	w9, w12, #2, ls
	cset	w13, hi
	and	w8, w8, #0xfffffffc
	mov	w14, #1920
	cmp	w13, #0
	csel	w13, w14, w8, ne
	and	w8, w9, #0xfffffffe
	csel	w8, w12, w8, ne
	cmp	w9, #144
	csel	w8, w11, w8, lt
	csel	w9, w10, w13, lt
LBB0_3:
	stp	w9, w8, [x19]
	ldr	w8, [x0]
	cmp	w8, #1
	b.ne	LBB0_5
; %bb.4:
Lloh0:
	adrp	x8, lCPI0_0@PAGE
Lloh1:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	str	d0, [x19]
Lloh2:
	adrp	x8, _V4L2_COLORSPACE_SRGB@GOTPAGE
Lloh3:
	ldr	x8, [x8, _V4L2_COLORSPACE_SRGB@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	str	w8, [x19, #24]
	b	LBB0_6
LBB0_5:
Lloh5:
	adrp	x8, _V4L2_SUBDEV_FORMAT_ACTIVE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _V4L2_SUBDEV_FORMAT_ACTIVE@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	ldp	w0, w9, [x0, #4]
	stp	w8, w9, [sp, #4]
Lloh8:
	adrp	x8, _pad@GOTPAGE
Lloh9:
	ldr	x8, [x8, _pad@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
Lloh11:
	adrp	x8, _get_fmt@GOTPAGE
Lloh12:
	ldr	x8, [x8, _get_fmt@GOTPAGEOFF]
Lloh13:
	ldr	w2, [x8]
	mov	x4, sp
	mov	x3, #0
	bl	_v4l2_subdev_call
	mov	x1, sp
	mov	x0, x19
	bl	_v4l2_fill_pix_format
LBB0_6:
	ldr	w8, [x19, #8]
	cmp	w8, #129
	b.eq	LBB0_9
; %bb.7:
	cmp	w8, #130
	b.ne	LBB0_11
; %bb.8:
	ldr	w8, [x19, #12]
	and	w0, w8, #0xfffffffc
	ldr	w8, [x19]
Lloh14:
	adrp	x9, _COBALT_BYTES_PER_PIXEL_RGB32@GOTPAGE
Lloh15:
	ldr	x9, [x9, _COBALT_BYTES_PER_PIXEL_RGB32@GOTPAGEOFF]
	b	LBB0_10
LBB0_9:
	ldr	w8, [x19, #12]
	and	w0, w8, #0xfffffffc
	ldr	w8, [x19]
Lloh16:
	adrp	x9, _COBALT_BYTES_PER_PIXEL_RGB24@GOTPAGE
Lloh17:
	ldr	x9, [x9, _COBALT_BYTES_PER_PIXEL_RGB24@GOTPAGEOFF]
LBB0_10:
	ldr	w9, [x9]
	mul	w1, w9, w8
	bl	_max
	str	w0, [x19, #12]
                                        ; kill: def $w0 killed $w0 killed $x0 def $x0
	b	LBB0_12
LBB0_11:
	ldr	w8, [x19, #12]
	and	w0, w8, #0xfffffffc
	ldr	w8, [x19]
Lloh18:
	adrp	x9, _COBALT_BYTES_PER_PIXEL_YUYV@GOTPAGE
Lloh19:
	ldr	x9, [x9, _COBALT_BYTES_PER_PIXEL_YUYV@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	mul	w1, w9, w8
	bl	_max
	mov	w8, #128
	stp	w8, w0, [x19, #8]
LBB0_12:
	ldr	w8, [x19, #4]
	mul	w8, w8, w0
Lloh21:
	adrp	x9, _V4L2_FIELD_NONE@GOTPAGE
Lloh22:
	ldr	x9, [x9, _V4L2_FIELD_NONE@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	stp	w8, w9, [x19, #16]
	mov	w0, #0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdrp	Lloh0, Lloh2
	.loh AdrpLdr	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_V4L2_COLORSPACE_SRGB,4,2       ; @V4L2_COLORSPACE_SRGB
	.comm	_V4L2_SUBDEV_FORMAT_ACTIVE,4,2  ; @V4L2_SUBDEV_FORMAT_ACTIVE
	.comm	_pad,4,2                        ; @pad
	.comm	_get_fmt,4,2                    ; @get_fmt
	.comm	_COBALT_BYTES_PER_PIXEL_YUYV,4,2 ; @COBALT_BYTES_PER_PIXEL_YUYV
	.comm	_COBALT_BYTES_PER_PIXEL_RGB24,4,2 ; @COBALT_BYTES_PER_PIXEL_RGB24
	.comm	_COBALT_BYTES_PER_PIXEL_RGB32,4,2 ; @COBALT_BYTES_PER_PIXEL_RGB32
	.comm	_V4L2_FIELD_NONE,4,2            ; @V4L2_FIELD_NONE
	.no_dead_strip	_cobalt_try_fmt_vid_cap
.subsections_via_symbols
