	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bt3c_download_firmware
_bt3c_download_firmware:                ## @bt3c_download_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	movl	(%rdi), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_device_printf
	movq	%rbx, %rdi
	movl	$32832, %esi                    ## imm = 0x8040
	movl	$1028, %edx                     ## imm = 0x404
	callq	_bt3c_write
	movq	%rbx, %rdi
	movl	$32832, %esi                    ## imm = 0x8040
	movl	$1024, %edx                     ## imm = 0x400
	callq	_bt3c_write
	movl	$1, %edi
	callq	_DELAY
	movq	%rbx, %rdi
	movl	$32832, %esi                    ## imm = 0x8040
	movl	$1028, %edx                     ## imm = 0x404
	callq	_bt3c_write
	movl	$17, %edi
	callq	_DELAY
	movl	(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_device_printf
	testl	%r14d, %r14d
	jle	LBB0_8
## %bb.1:
	xorl	%r12d, %r12d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	addl	%eax, %eax
	addl	8(%r13), %eax
	addl	%eax, %r12d
	addl	$16, %r12d
	cmpl	%r14d, %r12d
	jge	LBB0_8
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
	movslq	%r12d, %r13
	addq	-48(%rbp), %r13                 ## 8-byte Folded Reload
	movq	_bootverbose@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%rbx), %edi
	movl	(%r13), %edx
	movl	4(%r13), %ecx
	movq	8(%r13), %r8
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_device_printf
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r13), %esi
	movq	%rbx, %rdi
	callq	_bt3c_set_address
	movl	4(%r13), %eax
	testl	%eax, %eax
	jle	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_6:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	16(%r13,%r15,4), %esi
	movq	%rbx, %rdi
	callq	_bt3c_write_data
	incq	%r15
	movslq	4(%r13), %rax
	cmpq	%rax, %r15
	jl	LBB0_6
	jmp	LBB0_7
LBB0_8:
	movl	$17, %edi
	callq	_DELAY
	movl	(%rbx), %edi
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_device_printf
	movl	(%rbx), %edi
	leaq	L_.str.4(%rip), %rsi
	xorl	%eax, %eax
	callq	_device_printf
	movq	%rbx, %rdi
	movl	$12288, %esi                    ## imm = 0x3000
	callq	_bt3c_set_address
	movq	%rbx, %rdi
	callq	_bt3c_read_control
	movq	%rbx, %rdi
	movl	$-1, %esi
	callq	_bt3c_write_control
	movl	$17, %edi
	callq	_DELAY
	movl	(%rbx), %edi
	leaq	L_.str.5(%rip), %rsi
	xorl	%eax, %eax
	callq	_device_printf
	movq	%rbx, %rdi
	movl	$28678, %esi                    ## imm = 0x7006
	xorl	%edx, %edx
	callq	_bt3c_write
	movq	%rbx, %rdi
	movl	$28677, %esi                    ## imm = 0x7005
	xorl	%edx, %edx
	callq	_bt3c_write
	movq	%rbx, %rdi
	movl	$28673, %esi                    ## imm = 0x7001
	xorl	%edx, %edx
	callq	_bt3c_write
	movl	$1000, %edi                     ## imm = 0x3E8
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_DELAY                          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Reseting the card...\n"

L_.str.1:                               ## @.str.1
	.asciz	"Starting firmware download process...\n"

	.comm	_bootverbose,8,3                ## @bootverbose
L_.str.2:                               ## @.str.2
	.asciz	"Download firmware block, address=%#08x, size=%d words, aligment=%d\n"

L_.str.3:                               ## @.str.3
	.asciz	"Firmware download process complete\n"

L_.str.4:                               ## @.str.4
	.asciz	"Starting the card...\n"

L_.str.5:                               ## @.str.5
	.asciz	"Clearing card registers...\n"

	.no_dead_strip	_bt3c_download_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bt3c_download_firmware
_bt3c_download_firmware:                ; @bt3c_download_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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, x2
	mov	x21, x1
	mov	x19, x0
	ldr	w0, [x0]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_device_printf
	mov	x0, x19
	mov	w1, #32832
	mov	w2, #1028
	bl	_bt3c_write
	mov	x0, x19
	mov	w1, #32832
	mov	w2, #1024
	bl	_bt3c_write
	mov	w0, #1
	bl	_DELAY
	mov	x0, x19
	mov	w1, #32832
	mov	w2, #1028
	bl	_bt3c_write
	mov	w0, #17
	bl	_DELAY
	ldr	w0, [x19]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_device_printf
	cmp	w20, #1
	b.lt	LBB0_8
; %bb.1:
	mov	w23, #0
Lloh4:
	adrp	x24, _bootverbose@GOTPAGE
Lloh5:
	ldr	x24, [x24, _bootverbose@GOTPAGEOFF]
Lloh6:
	adrp	x22, l_.str.2@PAGE
Lloh7:
	add	x22, x22, l_.str.2@PAGEOFF
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w9, [x25, #8]
	add	w8, w9, w8, lsl #1
	add	w8, w8, w23
	add	w23, w8, #16
	cmp	w23, w20
	b.ge	LBB0_8
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
	add	x25, x21, w23, sxtw
	ldr	x8, [x24]
	cbz	x8, LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x19]
	ldr	x8, [x25, #8]
	ldp	w9, w10, [x25]
	stp	x10, x8, [sp, #8]
	str	x9, [sp]
	mov	x1, x22
	bl	_device_printf
LBB0_5:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w1, [x25]
	mov	x0, x19
	bl	_bt3c_set_address
	ldr	w8, [x25, #4]
	cmp	w8, #1
	b.lt	LBB0_2
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x26, #0
	add	x27, x25, #16
LBB0_7:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w1, [x27, x26, lsl #2]
	mov	x0, x19
	bl	_bt3c_write_data
	add	x26, x26, #1
	ldrsw	x8, [x25, #4]
	cmp	x26, x8
	b.lt	LBB0_7
	b	LBB0_2
LBB0_8:
	mov	w0, #17
	bl	_DELAY
	ldr	w0, [x19]
Lloh8:
	adrp	x1, l_.str.3@PAGE
Lloh9:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_device_printf
	ldr	w0, [x19]
Lloh10:
	adrp	x1, l_.str.4@PAGE
Lloh11:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_device_printf
	mov	x0, x19
	mov	w1, #12288
	bl	_bt3c_set_address
	mov	x0, x19
	bl	_bt3c_read_control
	mov	x0, x19
	mov	w1, #-1
	bl	_bt3c_write_control
	mov	w0, #17
	bl	_DELAY
	ldr	w0, [x19]
Lloh12:
	adrp	x1, l_.str.5@PAGE
Lloh13:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_device_printf
	mov	x0, x19
	mov	w1, #28678
	mov	w2, #0
	bl	_bt3c_write
	mov	x0, x19
	mov	w1, #28677
	mov	w2, #0
	bl	_bt3c_write
	mov	x0, x19
	mov	w1, #28673
	mov	w2, #0
	bl	_bt3c_write
	mov	w0, #1000
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	b	_DELAY
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Reseting the card...\n"

l_.str.1:                               ; @.str.1
	.asciz	"Starting firmware download process...\n"

	.comm	_bootverbose,8,3                ; @bootverbose
l_.str.2:                               ; @.str.2
	.asciz	"Download firmware block, address=%#08x, size=%d words, aligment=%d\n"

l_.str.3:                               ; @.str.3
	.asciz	"Firmware download process complete\n"

l_.str.4:                               ; @.str.4
	.asciz	"Starting the card...\n"

l_.str.5:                               ; @.str.5
	.asciz	"Clearing card registers...\n"

	.no_dead_strip	_bt3c_download_firmware
.subsections_via_symbols
