	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function blackbird_load_firmware
_blackbird_load_firmware:               ## @blackbird_load_firmware
	.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, %r15
	movl	$0, -44(%rbp)
	movl	(%rdi), %edi
	movq	_IVTV_REG_VPU@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$-19, %edx
	callq	_register_write
	movl	%eax, %r14d
	movl	(%r15), %edi
	movq	_IVTV_REG_HW_BLOCKS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_IVTV_CMD_HW_BLOCKS_RST@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	callq	_register_write
	movl	%eax, %r12d
	orl	%r14d, %r12d
	movl	(%r15), %edi
	movq	_IVTV_REG_ENC_SDRAM_REFRESH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$-2147482048, %edx              ## imm = 0x80000640
	callq	_register_write
	movl	%eax, %r14d
	movl	(%r15), %edi
	movq	_IVTV_REG_ENC_SDRAM_PRECHARGE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$26, %edx
	callq	_register_write
	movl	%eax, %ebx
	orl	%r14d, %ebx
	orl	%r12d, %ebx
	movl	$10000, %edi                    ## imm = 0x2710
	movl	$20000, %esi                    ## imm = 0x4E20
	callq	_usleep_range
	movl	(%r15), %edi
	movq	_IVTV_REG_APU@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_register_write
	orl	%ebx, %eax
	jns	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	xorl	%edi, %edi
	callq	_dprintk
LBB0_2:
	movq	_CX2341X_FIRM_ENC_FILENAME@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	8(%r15), %rdx
	leaq	-56(%rbp), %rdi
	callq	_request_firmware
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movl	(%rbx), %esi
	leaq	L_.str.1(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_pr_err
	leaq	L_.str.2(%rip), %rdi
LBB0_19:
	xorl	%eax, %eax
	callq	_pr_err
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_20
LBB0_4:
	movq	-56(%rbp), %rax
	movl	(%rax), %esi
	movq	_BLACKBIRD_FIRM_IMAGE_SIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	cmpl	%edx, %esi
	jne	LBB0_5
## %bb.7:
	movq	8(%rax), %rdi
	leaq	_blackbird_load_firmware.magic(%rip), %rsi
	movl	$8, %edx
	callq	_memcmp
	testq	%rax, %rax
	je	LBB0_9
## %bb.8:
	leaq	L_.str.4(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_pr_err
	jmp	LBB0_6
LBB0_5:
	leaq	L_.str.3(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_pr_err
LBB0_6:
	movq	-56(%rbp), %rdi
	callq	_release_firmware
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_20:
	subl	(%rax), %r14d
LBB0_21:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	leaq	L_.str.5(%rip), %rsi
	movl	$1, %edi
	callq	_dprintk
	movq	-56(%rbp), %rdi
	cmpl	$3, (%rdi)
	jle	LBB0_10
## %bb.13:
	movq	8(%rdi), %r14
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r14,%rbx,4), %edi
	callq	_le32_to_cpu
	movl	%eax, -44(%rbp)
	movl	%eax, %ecx
	notl	%ecx
	addl	%ecx, %r12d
	movl	(%r15), %edi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_memory_write
	movq	-56(%rbp), %rax
	movl	(%rax), %eax
	sarl	$2, %eax
	incq	%rbx
	cmpl	%eax, %ebx
	jl	LBB0_14
## %bb.15:
	incl	%ebx
	leaq	-44(%rbp), %r14
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	leal	-2(%rbx), %esi
	movl	(%r15), %edi
	movq	%r14, %rdx
	callq	_memory_read
	movl	-44(%rbp), %eax
	addl	%eax, %r12d
	incl	%r12d
	decl	%ebx
	cmpl	$1, %ebx
	jg	LBB0_16
## %bb.17:
	movq	-56(%rbp), %rdi
	callq	_release_firmware
	testl	%r12d, %r12d
	je	LBB0_11
## %bb.18:
	leaq	L_.str.6(%rip), %rdi
	xorl	%r14d, %r14d
	jmp	LBB0_19
LBB0_10:
	callq	_release_firmware
LBB0_11:
	leaq	L_.str.7(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%edi, %edi
	callq	_dprintk
	movl	(%r15), %edi
	movq	_IVTV_REG_HW_BLOCKS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r13), %edx
	callq	_register_write
	movl	%eax, %ebx
	movl	(%r15), %edi
	movq	_IVTV_REG_SPU@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	leaq	-44(%rbp), %rdx
	callq	_register_read
	movl	%eax, %r12d
	orl	%ebx, %r12d
	movl	(%r15), %edi
	movl	(%r13), %esi
	movl	-44(%rbp), %edx
	andl	$-2, %edx
	callq	_register_write
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movl	$10000, %edi                    ## imm = 0x2710
	movl	$20000, %esi                    ## imm = 0x4E20
	callq	_usleep_range
	movl	(%r15), %edi
	movq	_IVTV_REG_VPU@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	leaq	-44(%rbp), %rdx
	callq	_register_read
	movl	%eax, %ebx
	orl	-60(%rbp), %ebx                 ## 4-byte Folded Reload
	orl	%r12d, %ebx
	movl	(%r15), %edi
	movl	(%r13), %esi
	movl	-44(%rbp), %edx
	andl	$-24, %edx
	callq	_register_write
	orl	%ebx, %eax
	jns	LBB0_21
## %bb.12:
	leaq	L_.str(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%edi, %edi
	callq	_dprintk
	jmp	LBB0_21
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
_blackbird_load_firmware.magic:         ## @blackbird_load_firmware.magic
	.ascii	"\247\r\000\000f\273U\252"

	.comm	_IVTV_REG_VPU,4,2               ## @IVTV_REG_VPU
	.comm	_IVTV_REG_HW_BLOCKS,4,2         ## @IVTV_REG_HW_BLOCKS
	.comm	_IVTV_CMD_HW_BLOCKS_RST,4,2     ## @IVTV_CMD_HW_BLOCKS_RST
	.comm	_IVTV_REG_ENC_SDRAM_REFRESH,4,2 ## @IVTV_REG_ENC_SDRAM_REFRESH
	.comm	_IVTV_REG_ENC_SDRAM_PRECHARGE,4,2 ## @IVTV_REG_ENC_SDRAM_PRECHARGE
	.comm	_IVTV_REG_APU,4,2               ## @IVTV_REG_APU
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Error with register_write\n"

	.comm	_CX2341X_FIRM_ENC_FILENAME,4,2  ## @CX2341X_FIRM_ENC_FILENAME
L_.str.1:                               ## @.str.1
	.asciz	"Hotplug firmware request failed (%s).\n"

L_.str.2:                               ## @.str.2
	.asciz	"Please fix your hotplug setup, the board will not work without firmware loaded!\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_BLACKBIRD_FIRM_IMAGE_SIZE,4,2  ## @BLACKBIRD_FIRM_IMAGE_SIZE
L_.str.3:                               ## @.str.3
	.asciz	"Firmware size mismatch (have %zd, expected %d)\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.4:                               ## @.str.4
	.asciz	"Firmware magic mismatch, wrong file?\n"

L_.str.5:                               ## @.str.5
	.asciz	"Loading firmware ...\n"

L_.str.6:                               ## @.str.6
	.asciz	"Firmware load might have failed (checksum mismatch).\n"

L_.str.7:                               ## @.str.7
	.asciz	"Firmware upload successful.\n"

	.comm	_IVTV_REG_SPU,4,2               ## @IVTV_REG_SPU
	.no_dead_strip	_blackbird_load_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function blackbird_load_firmware
_blackbird_load_firmware:               ; @blackbird_load_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x19, x0
	str	wzr, [sp, #20]
	ldr	w0, [x0]
Lloh0:
	adrp	x21, _IVTV_REG_VPU@GOTPAGE
Lloh1:
	ldr	x21, [x21, _IVTV_REG_VPU@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	w2, #-19
	bl	_register_write
	mov	x20, x0
	ldr	w0, [x19]
Lloh2:
	adrp	x22, _IVTV_REG_HW_BLOCKS@GOTPAGE
Lloh3:
	ldr	x22, [x22, _IVTV_REG_HW_BLOCKS@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh4:
	adrp	x23, _IVTV_CMD_HW_BLOCKS_RST@GOTPAGE
Lloh5:
	ldr	x23, [x23, _IVTV_CMD_HW_BLOCKS_RST@GOTPAGEOFF]
	ldr	w2, [x23]
	bl	_register_write
	orr	w20, w0, w20
	ldr	w0, [x19]
Lloh6:
	adrp	x8, _IVTV_REG_ENC_SDRAM_REFRESH@GOTPAGE
Lloh7:
	ldr	x8, [x8, _IVTV_REG_ENC_SDRAM_REFRESH@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	w2, #1600
	movk	w2, #32768, lsl #16
	bl	_register_write
	orr	w20, w20, w0
	ldr	w0, [x19]
Lloh9:
	adrp	x8, _IVTV_REG_ENC_SDRAM_PRECHARGE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _IVTV_REG_ENC_SDRAM_PRECHARGE@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	w2, #26
	bl	_register_write
	orr	w20, w20, w0
	mov	w0, #10000
	mov	w1, #20000
	bl	_usleep_range
	ldr	w0, [x19]
Lloh12:
	adrp	x8, _IVTV_REG_APU@GOTPAGE
Lloh13:
	ldr	x8, [x8, _IVTV_REG_APU@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_register_write
	orr	w8, w20, w0
	tbz	w8, #31, LBB0_2
; %bb.1:
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #0
	bl	_dprintk
LBB0_2:
Lloh17:
	adrp	x20, _CX2341X_FIRM_ENC_FILENAME@GOTPAGE
Lloh18:
	ldr	x20, [x20, _CX2341X_FIRM_ENC_FILENAME@GOTPAGEOFF]
	ldr	w1, [x20]
	ldr	x2, [x19, #8]
	add	x0, sp, #24
	bl	_request_firmware
	cbz	w0, LBB0_5
; %bb.3:
	ldr	w8, [x20]
	str	x8, [sp]
Lloh19:
	adrp	x0, l_.str.1@PAGE
Lloh20:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_err
Lloh21:
	adrp	x0, l_.str.2@PAGE
Lloh22:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_4:
	bl	_pr_err
Lloh23:
	adrp	x8, _EIO@GOTPAGE
Lloh24:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_10
LBB0_5:
	ldr	x9, [sp, #24]
	ldr	w8, [x9]
Lloh25:
	adrp	x10, _BLACKBIRD_FIRM_IMAGE_SIZE@GOTPAGE
Lloh26:
	ldr	x10, [x10, _BLACKBIRD_FIRM_IMAGE_SIZE@GOTPAGEOFF]
Lloh27:
	ldr	w10, [x10]
	cmp	w8, w10
	b.ne	LBB0_8
; %bb.6:
	ldr	x0, [x9, #8]
Lloh28:
	adrp	x1, _blackbird_load_firmware.magic@PAGE
Lloh29:
	add	x1, x1, _blackbird_load_firmware.magic@PAGEOFF
	mov	w2, #8
	bl	_memcmp
	cbz	x0, LBB0_12
; %bb.7:
Lloh30:
	adrp	x0, l_.str.4@PAGE
Lloh31:
	add	x0, x0, l_.str.4@PAGEOFF
	b	LBB0_9
LBB0_8:
	stp	x8, x10, [sp]
Lloh32:
	adrp	x0, l_.str.3@PAGE
Lloh33:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_9:
	bl	_pr_err
	ldr	x0, [sp, #24]
	bl	_release_firmware
Lloh34:
	adrp	x8, _EINVAL@GOTPAGE
Lloh35:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_11:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_12:
Lloh36:
	adrp	x1, l_.str.5@PAGE
Lloh37:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	w0, #1
	bl	_dprintk
	ldr	x0, [sp, #24]
	ldr	w8, [x0]
	cmp	w8, #3
	b.le	LBB0_19
; %bb.13:
	mov	x20, #0
	mov	w24, #0
	ldr	x25, [x0, #8]
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x25, x20, lsl #2]
	bl	_le32_to_cpu
	mov	x2, x0
	str	w0, [sp, #20]
	mvn	w8, w0
	add	w24, w24, w8
	ldr	w0, [x19]
	mov	x1, x20
	bl	_memory_write
	ldr	x8, [sp, #24]
	ldr	w8, [x8]
	add	x20, x20, #1
	cmp	w20, w8, asr #2
	b.lt	LBB0_14
; %bb.15:
	add	w20, w20, #1
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	sub	w1, w20, #2
	ldr	w0, [x19]
	add	x2, sp, #20
	bl	_memory_read
	ldr	w8, [sp, #20]
	add	w8, w24, w8
	add	w24, w8, #1
	sub	w20, w20, #1
	cmp	w20, #1
	b.gt	LBB0_16
; %bb.17:
	ldr	x0, [sp, #24]
	bl	_release_firmware
	cbz	w24, LBB0_20
; %bb.18:
Lloh38:
	adrp	x0, l_.str.6@PAGE
Lloh39:
	add	x0, x0, l_.str.6@PAGEOFF
	b	LBB0_4
LBB0_19:
	bl	_release_firmware
LBB0_20:
Lloh40:
	adrp	x1, l_.str.7@PAGE
Lloh41:
	add	x1, x1, l_.str.7@PAGEOFF
	mov	w0, #0
	bl	_dprintk
	ldr	w0, [x19]
	ldr	w1, [x22]
	ldr	w2, [x23]
	bl	_register_write
	mov	x20, x0
	ldr	w0, [x19]
Lloh42:
	adrp	x22, _IVTV_REG_SPU@GOTPAGE
Lloh43:
	ldr	x22, [x22, _IVTV_REG_SPU@GOTPAGEOFF]
	ldr	w1, [x22]
	add	x2, sp, #20
	bl	_register_read
	orr	w20, w0, w20
	ldr	w0, [x19]
	ldr	w1, [x22]
	ldr	w8, [sp, #20]
	and	w2, w8, #0xfffffffe
	bl	_register_write
	orr	w20, w20, w0
	mov	w0, #10000
	mov	w1, #20000
	bl	_usleep_range
	ldr	w0, [x19]
	ldr	w1, [x21]
	add	x2, sp, #20
	bl	_register_read
	orr	w20, w20, w0
	ldr	w0, [x19]
	ldr	w1, [x21]
	ldr	w8, [sp, #20]
	mov	w9, #-24
	and	w2, w8, w9
	bl	_register_write
	mov	x8, x0
	mov	w0, #0
	orr	w8, w20, w8
	tbz	w8, #31, LBB0_11
; %bb.21:
Lloh44:
	adrp	x1, l_.str@PAGE
Lloh45:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #0
	bl	_dprintk
	mov	w0, #0
	b	LBB0_11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh34, Lloh35
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh42, Lloh43
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpAdd	Lloh44, Lloh45
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
_blackbird_load_firmware.magic:         ; @blackbird_load_firmware.magic
	.ascii	"\247\r\000\000f\273U\252"

	.comm	_IVTV_REG_VPU,4,2               ; @IVTV_REG_VPU
	.comm	_IVTV_REG_HW_BLOCKS,4,2         ; @IVTV_REG_HW_BLOCKS
	.comm	_IVTV_CMD_HW_BLOCKS_RST,4,2     ; @IVTV_CMD_HW_BLOCKS_RST
	.comm	_IVTV_REG_ENC_SDRAM_REFRESH,4,2 ; @IVTV_REG_ENC_SDRAM_REFRESH
	.comm	_IVTV_REG_ENC_SDRAM_PRECHARGE,4,2 ; @IVTV_REG_ENC_SDRAM_PRECHARGE
	.comm	_IVTV_REG_APU,4,2               ; @IVTV_REG_APU
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Error with register_write\n"

	.comm	_CX2341X_FIRM_ENC_FILENAME,4,2  ; @CX2341X_FIRM_ENC_FILENAME
l_.str.1:                               ; @.str.1
	.asciz	"Hotplug firmware request failed (%s).\n"

l_.str.2:                               ; @.str.2
	.asciz	"Please fix your hotplug setup, the board will not work without firmware loaded!\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_BLACKBIRD_FIRM_IMAGE_SIZE,4,2  ; @BLACKBIRD_FIRM_IMAGE_SIZE
l_.str.3:                               ; @.str.3
	.asciz	"Firmware size mismatch (have %zd, expected %d)\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.4:                               ; @.str.4
	.asciz	"Firmware magic mismatch, wrong file?\n"

l_.str.5:                               ; @.str.5
	.asciz	"Loading firmware ...\n"

l_.str.6:                               ; @.str.6
	.asciz	"Firmware load might have failed (checksum mismatch).\n"

l_.str.7:                               ; @.str.7
	.asciz	"Firmware upload successful.\n"

	.comm	_IVTV_REG_SPU,4,2               ; @IVTV_REG_SPU
	.no_dead_strip	_blackbird_load_firmware
.subsections_via_symbols
