	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function coda_encode_header
_coda_encode_header:                    ## @coda_encode_header
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, -72(%rbp)                  ## 8-byte Spill
	movq	%rcx, %r13
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %r14
	movq	16(%rdi), %r15
	movq	(%r15), %rax
	movq	(%rax), %rax
	movq	_CODA_960@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rax
	jne	LBB0_2
## %bb.1:
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_vb2_plane_vaddr
	movq	%rax, %rdi
	xorl	%esi, %esi
	movl	$64, %edx
	callq	_memset
LBB0_2:
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_vb2_dma_contig_plane_dma_addr
	movq	_CODA_CMD_ENC_HEADER_BB_START@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_coda_write
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_vb2_plane_size
	movq	(%r15), %rcx
	movq	(%rcx), %rcx
	movq	%rax, %rsi
	shrq	$10, %rsi
	cmpq	(%rbx), %rcx
	cmovnel	%eax, %esi
	movq	_CODA_CMD_ENC_HEADER_BB_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_coda_write
	movq	(%r15), %rax
	movq	(%rax), %rax
	cmpq	(%rbx), %rax
	jne	LBB0_10
## %bb.3:
	movq	8(%r14), %rax
	movq	(%rax), %rax
	movq	_V4L2_PIX_FMT_H264@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_10
## %bb.4:
	movq	_CODA_HEADER_H264_SPS@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	cmpl	%esi, (%rax)
	jne	LBB0_11
## %bb.5:
	movq	_V4L2_BUF_TYPE_VIDEO_OUTPUT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_get_q_data
	movq	%rax, %rbx
	movl	(%rax), %edi
	testb	$15, %dil
	jne	LBB0_7
## %bb.6:
	testb	$15, 4(%rbx)
	je	LBB0_10
LBB0_7:
	movl	$16, %esi
	callq	_round_up
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movl	%eax, %r14d
	subl	(%rbx), %r14d
	movl	4(%rbx), %edi
	movl	$16, %esi
	callq	_round_up
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	movl	%eax, %r13d
	subl	4(%rbx), %r13d
	movq	_CODA9_CMD_ENC_HEADER_FRAME_CROP_H@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	callq	_coda_write
	movq	_CODA9_CMD_ENC_HEADER_FRAME_CROP_V@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r13d, %esi
	movq	-64(%rbp), %r13                 ## 8-byte Reload
	callq	_coda_write
	movq	_CODA9_HEADER_FRAME_CROP@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	orl	(%rax), %esi
	jmp	LBB0_11
LBB0_10:
	movl	-44(%rbp), %esi                 ## 4-byte Reload
LBB0_11:
	movq	_CODA_CMD_ENC_HEADER_CODE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_coda_write
	movq	_CODA_COMMAND_ENCODE_HEADER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_coda_command_sync
	testl	%eax, %eax
	js	LBB0_18
## %bb.12:
	movq	(%r15), %rax
	movq	(%rax), %rax
	movq	_CODA_960@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_19
## %bb.13:
	movl	$64, %ebx
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	leal	-1(%rbx), %r14d
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_vb2_plane_vaddr
	cmpb	$0, (%rax,%r14)
	jne	LBB0_17
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=1
	decl	%ebx
	cmpl	$1, %ebx
	ja	LBB0_14
## %bb.16:
	xorl	%r14d, %r14d
LBB0_17:
	incl	%r14d
	jmp	LBB0_20
LBB0_18:
	movl	%eax, %ebx
	addq	$8, %r15
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	callq	_v4l2_err
	jmp	LBB0_21
LBB0_19:
	movl	(%r14), %edi
	callq	_CODA_REG_BIT_WR_PTR
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_coda_read
	movl	%eax, %r14d
	movq	_CODA_CMD_ENC_HEADER_BB_START@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_coda_read
	subl	%eax, %r14d
LBB0_20:
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movl	%r14d, (%r15)
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_vb2_plane_vaddr
	movl	(%r15), %edx
	movq	%r13, %rdi
	movq	%rax, %rsi
	callq	_memcpy
LBB0_21:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CODA_960,8,3                   ## @CODA_960
	.comm	_CODA_CMD_ENC_HEADER_BB_START,4,2 ## @CODA_CMD_ENC_HEADER_BB_START
	.comm	_CODA_CMD_ENC_HEADER_BB_SIZE,4,2 ## @CODA_CMD_ENC_HEADER_BB_SIZE
	.comm	_V4L2_PIX_FMT_H264,8,3          ## @V4L2_PIX_FMT_H264
	.comm	_CODA_HEADER_H264_SPS,4,2       ## @CODA_HEADER_H264_SPS
	.comm	_V4L2_BUF_TYPE_VIDEO_OUTPUT,4,2 ## @V4L2_BUF_TYPE_VIDEO_OUTPUT
	.comm	_CODA9_CMD_ENC_HEADER_FRAME_CROP_H,4,2 ## @CODA9_CMD_ENC_HEADER_FRAME_CROP_H
	.comm	_CODA9_CMD_ENC_HEADER_FRAME_CROP_V,4,2 ## @CODA9_CMD_ENC_HEADER_FRAME_CROP_V
	.comm	_CODA9_HEADER_FRAME_CROP,4,2    ## @CODA9_HEADER_FRAME_CROP
	.comm	_CODA_CMD_ENC_HEADER_CODE,4,2   ## @CODA_CMD_ENC_HEADER_CODE
	.comm	_CODA_COMMAND_ENCODE_HEADER,4,2 ## @CODA_COMMAND_ENCODE_HEADER
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"CODA_COMMAND_ENCODE_HEADER timeout\n"

	.no_dead_strip	_coda_encode_header
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function coda_encode_header
_coda_encode_header:                    ; @coda_encode_header
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x4
	mov	x19, x3
	mov	x24, x2
	mov	x21, x1
	mov	x23, x0
	ldr	x22, [x0, #16]
	ldr	x8, [x22]
	ldr	x8, [x8]
Lloh0:
	adrp	x27, _CODA_960@GOTPAGE
Lloh1:
	ldr	x27, [x27, _CODA_960@GOTPAGEOFF]
	ldr	x9, [x27]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
	mov	x0, x21
	mov	w1, #0
	bl	_vb2_plane_vaddr
	mov	w1, #0
	mov	w2, #64
	bl	_memset
LBB0_2:
	mov	x0, x21
	mov	w1, #0
	bl	_vb2_dma_contig_plane_dma_addr
	mov	x1, x0
Lloh2:
	adrp	x28, _CODA_CMD_ENC_HEADER_BB_START@GOTPAGE
Lloh3:
	ldr	x28, [x28, _CODA_CMD_ENC_HEADER_BB_START@GOTPAGEOFF]
	ldr	w2, [x28]
	mov	x0, x22
	bl	_coda_write
	mov	x0, x21
	mov	w1, #0
	bl	_vb2_plane_size
	ldr	x8, [x22]
	ldr	x8, [x8]
	ldr	x9, [x27]
	lsr	x10, x0, #10
	cmp	x8, x9
	csel	w1, w10, w0, eq
Lloh4:
	adrp	x8, _CODA_CMD_ENC_HEADER_BB_SIZE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _CODA_CMD_ENC_HEADER_BB_SIZE@GOTPAGEOFF]
Lloh6:
	ldr	w2, [x8]
	mov	x0, x22
	bl	_coda_write
	ldr	x8, [x22]
	ldr	x8, [x8]
	ldr	x9, [x27]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.3:
	ldr	x8, [x23, #8]
	ldr	x8, [x8]
Lloh7:
	adrp	x9, _V4L2_PIX_FMT_H264@GOTPAGE
Lloh8:
	ldr	x9, [x9, _V4L2_PIX_FMT_H264@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.4:
Lloh10:
	adrp	x8, _CODA_HEADER_H264_SPS@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CODA_HEADER_H264_SPS@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	cmp	w8, w24
	b.ne	LBB0_8
; %bb.5:
Lloh13:
	adrp	x8, _V4L2_BUF_TYPE_VIDEO_OUTPUT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _V4L2_BUF_TYPE_VIDEO_OUTPUT@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x0, x23
	bl	_get_q_data
	mov	x25, x0
	ldr	w0, [x0]
	tst	w0, #0xf
	b.ne	LBB0_7
; %bb.6:
	ldrb	w8, [x25, #4]
	tst	w8, #0xf
	b.eq	LBB0_8
LBB0_7:
	mov	w1, #16
	bl	_round_up
	ldp	w9, w8, [x25]
	sub	w26, w0, w9
	mov	x0, x8
	mov	w1, #16
	bl	_round_up
	ldr	w8, [x25, #4]
	sub	w25, w0, w8
Lloh16:
	adrp	x8, _CODA9_CMD_ENC_HEADER_FRAME_CROP_H@GOTPAGE
Lloh17:
	ldr	x8, [x8, _CODA9_CMD_ENC_HEADER_FRAME_CROP_H@GOTPAGEOFF]
Lloh18:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x26
	bl	_coda_write
Lloh19:
	adrp	x8, _CODA9_CMD_ENC_HEADER_FRAME_CROP_V@GOTPAGE
Lloh20:
	ldr	x8, [x8, _CODA9_CMD_ENC_HEADER_FRAME_CROP_V@GOTPAGEOFF]
Lloh21:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x25
	bl	_coda_write
Lloh22:
	adrp	x8, _CODA9_HEADER_FRAME_CROP@GOTPAGE
Lloh23:
	ldr	x8, [x8, _CODA9_HEADER_FRAME_CROP@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	orr	w24, w8, w24
LBB0_8:
Lloh25:
	adrp	x8, _CODA_CMD_ENC_HEADER_CODE@GOTPAGE
Lloh26:
	ldr	x8, [x8, _CODA_CMD_ENC_HEADER_CODE@GOTPAGEOFF]
Lloh27:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x24
	bl	_coda_write
Lloh28:
	adrp	x8, _CODA_COMMAND_ENCODE_HEADER@GOTPAGE
Lloh29:
	ldr	x8, [x8, _CODA_COMMAND_ENCODE_HEADER@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
	mov	x0, x23
	bl	_coda_command_sync
	tbnz	w0, #31, LBB0_15
; %bb.9:
	ldr	x8, [x22]
	ldr	x8, [x8]
	ldr	x9, [x27]
	cmp	x8, x9
	b.ne	LBB0_16
; %bb.10:
	mov	w22, #64
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	sub	w22, w22, #1
	mov	x0, x21
	mov	w1, #0
	bl	_vb2_plane_vaddr
	ldrb	w8, [x0, w22, uxtw]
	cbnz	w8, LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	cmp	w22, #1
	b.hi	LBB0_11
; %bb.13:
	mov	w22, #0
LBB0_14:
	add	w8, w22, #1
	b	LBB0_17
LBB0_15:
	mov	x24, x0
	add	x0, x22, #8
Lloh31:
	adrp	x1, l_.str@PAGE
Lloh32:
	add	x1, x1, l_.str@PAGEOFF
	bl	_v4l2_err
	b	LBB0_18
LBB0_16:
	ldr	w0, [x23]
	bl	_CODA_REG_BIT_WR_PTR
	mov	x1, x0
	mov	x0, x22
	bl	_coda_read
	mov	x23, x0
	ldr	w1, [x28]
	mov	x0, x22
	bl	_coda_read
	sub	w8, w23, w0
LBB0_17:
	str	w8, [x20]
	mov	x0, x21
	mov	w1, #0
	bl	_vb2_plane_vaddr
	mov	x1, x0
	ldr	w2, [x20]
	mov	x0, x19
	bl	_memcpy
	mov	w24, #0
LBB0_18:
	mov	x0, x24
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.comm	_CODA_960,8,3                   ; @CODA_960
	.comm	_CODA_CMD_ENC_HEADER_BB_START,4,2 ; @CODA_CMD_ENC_HEADER_BB_START
	.comm	_CODA_CMD_ENC_HEADER_BB_SIZE,4,2 ; @CODA_CMD_ENC_HEADER_BB_SIZE
	.comm	_V4L2_PIX_FMT_H264,8,3          ; @V4L2_PIX_FMT_H264
	.comm	_CODA_HEADER_H264_SPS,4,2       ; @CODA_HEADER_H264_SPS
	.comm	_V4L2_BUF_TYPE_VIDEO_OUTPUT,4,2 ; @V4L2_BUF_TYPE_VIDEO_OUTPUT
	.comm	_CODA9_CMD_ENC_HEADER_FRAME_CROP_H,4,2 ; @CODA9_CMD_ENC_HEADER_FRAME_CROP_H
	.comm	_CODA9_CMD_ENC_HEADER_FRAME_CROP_V,4,2 ; @CODA9_CMD_ENC_HEADER_FRAME_CROP_V
	.comm	_CODA9_HEADER_FRAME_CROP,4,2    ; @CODA9_HEADER_FRAME_CROP
	.comm	_CODA_CMD_ENC_HEADER_CODE,4,2   ; @CODA_CMD_ENC_HEADER_CODE
	.comm	_CODA_COMMAND_ENCODE_HEADER,4,2 ; @CODA_COMMAND_ENCODE_HEADER
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"CODA_COMMAND_ENCODE_HEADER timeout\n"

	.no_dead_strip	_coda_encode_header
.subsections_via_symbols
