	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function firmware_download
_firmware_download:                     ## @firmware_download
	.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	%rbx
	subq	$72, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movl	$0, -92(%rbp)
	callq	_check_fw
	movq	%rax, %rcx
	movl	$-1, %eax
	testq	%rcx, %rcx
	jne	LBB0_16
## %bb.1:
	movq	%r14, %rdi
	movl	$-2147286980, %esi              ## imm = 0x8003003C
	xorl	%edx, %edx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	callq	_update_by_mnemonic
	testl	%eax, %eax
	jne	LBB0_16
## %bb.2:
	movl	$1000, %edi                     ## imm = 0x3E8
	movl	$2000, %esi                     ## imm = 0x7D0
	callq	_usleep_range
	movq	_HYDRA_RESET_TRANSPORT_FIFO_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_HYDRA_RESET_TRANSPORT_FIFO_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_write_register
	testl	%eax, %eax
	jne	LBB0_16
## %bb.3:
	movq	_HYDRA_RESET_BBAND_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_HYDRA_RESET_BBAND_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_write_register
	testl	%eax, %eax
	jne	LBB0_16
## %bb.4:
	movq	_HYDRA_RESET_XBAR_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_HYDRA_RESET_XBAR_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_write_register
	testl	%eax, %eax
	jne	LBB0_16
## %bb.5:
	movq	_HYDRA_MODULES_CLK_2_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_HYDRA_DISABLE_CLK_2@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_write_register
	testl	%eax, %eax
	jne	LBB0_16
## %bb.6:
	movq	_HYDRA_PRCM_ROOT_CLK_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-92(%rbp), %rdx
	movq	%r14, %rdi
	callq	_read_register
	testl	%eax, %eax
	jne	LBB0_16
## %bb.7:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	%r15d, %edx
	callq	_do_firmware_download
	testl	%eax, %eax
	je	LBB0_8
LBB0_16:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-32(%rbp), %rcx
	jne	LBB0_18
## %bb.17:
	addq	$72, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	(%r14), %rax
	movq	(%rax), %rax
	movq	_MXL_HYDRA_DEVICE_568@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_11
## %bb.9:
	movl	$10000, %edi                    ## imm = 0x2710
	movl	$11000, %esi                    ## imm = 0x2AF8
	callq	_usleep_range
	movq	%r14, %rdi
	movl	$-1871577088, %esi              ## imm = 0x90720000
	movl	$1, %edx
	callq	_write_register
	testl	%eax, %eax
	jne	LBB0_16
## %bb.10:
	movl	$500, %edi                      ## imm = 0x1F4
	callq	_msleep
	movq	%r14, %rdi
	movl	$-1871268592, %esi              ## imm = 0x9076B510
	movl	$1, %edx
	callq	_write_register
	testl	%eax, %eax
	jne	LBB0_16
	jmp	LBB0_13
LBB0_11:
	movq	%r14, %rdi
	movl	$-2147286980, %esi              ## imm = 0x8003003C
	xorl	%edx, %edx
	movl	$1, %ecx
	movl	$1, %r8d
	callq	_update_by_mnemonic
	testl	%eax, %eax
	jne	LBB0_16
## %bb.12:
	movl	$150, %edi
	callq	_msleep
LBB0_13:
	movq	_XPT_DMD0_BASEADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$1985229328, %edx               ## imm = 0x76543210
	callq	_write_register
	testl	%eax, %eax
	jne	LBB0_16
## %bb.14:
	movq	%r14, %rdi
	callq	_firmware_is_alive
	movl	%eax, %ecx
	movl	$-1, %eax
	testl	%ecx, %ecx
	je	LBB0_16
## %bb.15:
	movl	8(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_info
	movl	$50, %edi
	callq	_msleep
	movq	(%r14), %rax
	movl	8(%rax), %eax
	movl	%eax, -88(%rbp)
	movq	_MXL_HYDRA_DEV_CFG_SKU_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_MXL_CMD_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-88(%rbp), %rcx
	leaq	-80(%rbp), %rbx
	movl	$4, %edx
	movq	%rbx, %r8
	callq	_BUILD_HYDRA_CMD
	movq	_MXL_HYDRA_CMD_HEADER_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	addl	$4, %esi
	movq	%r14, %rdi
	movq	%rbx, %rdx
	callq	_send_command
	jmp	LBB0_16
LBB0_18:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_HYDRA_RESET_TRANSPORT_FIFO_REG,4,2 ## @HYDRA_RESET_TRANSPORT_FIFO_REG
	.comm	_HYDRA_RESET_TRANSPORT_FIFO_DATA,4,2 ## @HYDRA_RESET_TRANSPORT_FIFO_DATA
	.comm	_HYDRA_RESET_BBAND_REG,4,2      ## @HYDRA_RESET_BBAND_REG
	.comm	_HYDRA_RESET_BBAND_DATA,4,2     ## @HYDRA_RESET_BBAND_DATA
	.comm	_HYDRA_RESET_XBAR_REG,4,2       ## @HYDRA_RESET_XBAR_REG
	.comm	_HYDRA_RESET_XBAR_DATA,4,2      ## @HYDRA_RESET_XBAR_DATA
	.comm	_HYDRA_MODULES_CLK_2_REG,4,2    ## @HYDRA_MODULES_CLK_2_REG
	.comm	_HYDRA_DISABLE_CLK_2,4,2        ## @HYDRA_DISABLE_CLK_2
	.comm	_HYDRA_PRCM_ROOT_CLK_REG,4,2    ## @HYDRA_PRCM_ROOT_CLK_REG
	.comm	_MXL_HYDRA_DEVICE_568,8,3       ## @MXL_HYDRA_DEVICE_568
	.comm	_XPT_DMD0_BASEADDR,4,2          ## @XPT_DMD0_BASEADDR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Hydra FW alive. Hail!\n"

	.comm	_MXL_HYDRA_DEV_CFG_SKU_CMD,4,2  ## @MXL_HYDRA_DEV_CFG_SKU_CMD
	.comm	_MXL_CMD_WRITE,4,2              ## @MXL_CMD_WRITE
	.comm	_MXL_HYDRA_CMD_HEADER_SIZE,4,2  ## @MXL_HYDRA_CMD_HEADER_SIZE
	.no_dead_strip	_firmware_download
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function firmware_download
_firmware_download:                     ; @firmware_download
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-40]
	str	wzr, [sp, #12]
	bl	_check_fw
	cbz	x0, LBB0_2
LBB0_1:
	mov	w0, #-1
	b	LBB0_9
LBB0_2:
	mov	x0, x19
	mov	w1, #60
	movk	w1, #32771, lsl #16
	mov	w2, #0
	mov	w3, #1
	mov	w4, #0
	bl	_update_by_mnemonic
	cbnz	w0, LBB0_9
; %bb.3:
	mov	w0, #1000
	mov	w1, #2000
	bl	_usleep_range
Lloh3:
	adrp	x8, _HYDRA_RESET_TRANSPORT_FIFO_REG@GOTPAGE
Lloh4:
	ldr	x8, [x8, _HYDRA_RESET_TRANSPORT_FIFO_REG@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
Lloh6:
	adrp	x8, _HYDRA_RESET_TRANSPORT_FIFO_DATA@GOTPAGE
Lloh7:
	ldr	x8, [x8, _HYDRA_RESET_TRANSPORT_FIFO_DATA@GOTPAGEOFF]
Lloh8:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_write_register
	cbnz	w0, LBB0_9
; %bb.4:
Lloh9:
	adrp	x8, _HYDRA_RESET_BBAND_REG@GOTPAGE
Lloh10:
	ldr	x8, [x8, _HYDRA_RESET_BBAND_REG@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
Lloh12:
	adrp	x8, _HYDRA_RESET_BBAND_DATA@GOTPAGE
Lloh13:
	ldr	x8, [x8, _HYDRA_RESET_BBAND_DATA@GOTPAGEOFF]
Lloh14:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_write_register
	cbnz	w0, LBB0_9
; %bb.5:
Lloh15:
	adrp	x8, _HYDRA_RESET_XBAR_REG@GOTPAGE
Lloh16:
	ldr	x8, [x8, _HYDRA_RESET_XBAR_REG@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
Lloh18:
	adrp	x8, _HYDRA_RESET_XBAR_DATA@GOTPAGE
Lloh19:
	ldr	x8, [x8, _HYDRA_RESET_XBAR_DATA@GOTPAGEOFF]
Lloh20:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_write_register
	cbnz	w0, LBB0_9
; %bb.6:
Lloh21:
	adrp	x8, _HYDRA_MODULES_CLK_2_REG@GOTPAGE
Lloh22:
	ldr	x8, [x8, _HYDRA_MODULES_CLK_2_REG@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
Lloh24:
	adrp	x8, _HYDRA_DISABLE_CLK_2@GOTPAGE
Lloh25:
	ldr	x8, [x8, _HYDRA_DISABLE_CLK_2@GOTPAGEOFF]
Lloh26:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_write_register
	cbnz	w0, LBB0_9
; %bb.7:
Lloh27:
	adrp	x8, _HYDRA_PRCM_ROOT_CLK_REG@GOTPAGE
Lloh28:
	ldr	x8, [x8, _HYDRA_PRCM_ROOT_CLK_REG@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x19
	bl	_read_register
	cbnz	w0, LBB0_9
; %bb.8:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	bl	_do_firmware_download
	cbz	w0, LBB0_11
LBB0_9:
	ldur	x8, [x29, #-40]
Lloh30:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh31:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh32:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_19
; %bb.10:
	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
	add	sp, sp, #112
	ret
LBB0_11:
	ldr	x8, [x19]
	ldr	x8, [x8]
Lloh33:
	adrp	x9, _MXL_HYDRA_DEVICE_568@GOTPAGE
Lloh34:
	ldr	x9, [x9, _MXL_HYDRA_DEVICE_568@GOTPAGEOFF]
Lloh35:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_14
; %bb.12:
	mov	w0, #10000
	mov	w1, #11000
	bl	_usleep_range
	mov	x0, x19
	mov	w1, #-1871577088
	mov	w2, #1
	bl	_write_register
	cbnz	w0, LBB0_9
; %bb.13:
	mov	w0, #500
	bl	_msleep
	mov	x0, x19
	mov	w1, #46352
	movk	w1, #36982, lsl #16
	mov	w2, #1
	bl	_write_register
	cbnz	w0, LBB0_9
	b	LBB0_16
LBB0_14:
	mov	x0, x19
	mov	w1, #60
	movk	w1, #32771, lsl #16
	mov	w2, #0
	mov	w3, #1
	mov	w4, #1
	bl	_update_by_mnemonic
	cbnz	w0, LBB0_9
; %bb.15:
	mov	w0, #150
	bl	_msleep
LBB0_16:
Lloh36:
	adrp	x8, _XPT_DMD0_BASEADDR@GOTPAGE
Lloh37:
	ldr	x8, [x8, _XPT_DMD0_BASEADDR@GOTPAGEOFF]
Lloh38:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #12816
	movk	w2, #30292, lsl #16
	bl	_write_register
	cbnz	w0, LBB0_9
; %bb.17:
	mov	x0, x19
	bl	_firmware_is_alive
	cbz	w0, LBB0_1
; %bb.18:
	ldr	w0, [x19, #8]
Lloh39:
	adrp	x1, l_.str@PAGE
Lloh40:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_info
	mov	w0, #50
	bl	_msleep
	ldr	x8, [x19]
	ldr	w8, [x8, #8]
	str	w8, [sp, #8]
Lloh41:
	adrp	x8, _MXL_HYDRA_DEV_CFG_SKU_CMD@GOTPAGE
Lloh42:
	ldr	x8, [x8, _MXL_HYDRA_DEV_CFG_SKU_CMD@GOTPAGEOFF]
Lloh43:
	ldr	w0, [x8]
Lloh44:
	adrp	x8, _MXL_CMD_WRITE@GOTPAGE
Lloh45:
	ldr	x8, [x8, _MXL_CMD_WRITE@GOTPAGEOFF]
Lloh46:
	ldr	w1, [x8]
	add	x3, sp, #8
	add	x4, sp, #16
	mov	w2, #4
	bl	_BUILD_HYDRA_CMD
Lloh47:
	adrp	x8, _MXL_HYDRA_CMD_HEADER_SIZE@GOTPAGE
Lloh48:
	ldr	x8, [x8, _MXL_HYDRA_CMD_HEADER_SIZE@GOTPAGEOFF]
Lloh49:
	ldr	w8, [x8]
	add	w1, w8, #4
	add	x2, sp, #16
	mov	x0, x19
	bl	_send_command
	b	LBB0_9
LBB0_19:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpAdd	Lloh39, Lloh40
	.cfi_endproc
                                        ; -- End function
	.comm	_HYDRA_RESET_TRANSPORT_FIFO_REG,4,2 ; @HYDRA_RESET_TRANSPORT_FIFO_REG
	.comm	_HYDRA_RESET_TRANSPORT_FIFO_DATA,4,2 ; @HYDRA_RESET_TRANSPORT_FIFO_DATA
	.comm	_HYDRA_RESET_BBAND_REG,4,2      ; @HYDRA_RESET_BBAND_REG
	.comm	_HYDRA_RESET_BBAND_DATA,4,2     ; @HYDRA_RESET_BBAND_DATA
	.comm	_HYDRA_RESET_XBAR_REG,4,2       ; @HYDRA_RESET_XBAR_REG
	.comm	_HYDRA_RESET_XBAR_DATA,4,2      ; @HYDRA_RESET_XBAR_DATA
	.comm	_HYDRA_MODULES_CLK_2_REG,4,2    ; @HYDRA_MODULES_CLK_2_REG
	.comm	_HYDRA_DISABLE_CLK_2,4,2        ; @HYDRA_DISABLE_CLK_2
	.comm	_HYDRA_PRCM_ROOT_CLK_REG,4,2    ; @HYDRA_PRCM_ROOT_CLK_REG
	.comm	_MXL_HYDRA_DEVICE_568,8,3       ; @MXL_HYDRA_DEVICE_568
	.comm	_XPT_DMD0_BASEADDR,4,2          ; @XPT_DMD0_BASEADDR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Hydra FW alive. Hail!\n"

	.comm	_MXL_HYDRA_DEV_CFG_SKU_CMD,4,2  ; @MXL_HYDRA_DEV_CFG_SKU_CMD
	.comm	_MXL_CMD_WRITE,4,2              ; @MXL_CMD_WRITE
	.comm	_MXL_HYDRA_CMD_HEADER_SIZE,4,2  ; @MXL_HYDRA_CMD_HEADER_SIZE
	.no_dead_strip	_firmware_download
.subsections_via_symbols
