	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mxt_load_fw
_mxt_load_fw:                           ## @mxt_load_fw
	.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	%rsi, %rbx
	movq	%rdi, %r13
	callq	_dev_get_drvdata
	movq	%rax, %r15
	movq	$0, -48(%rbp)
	leaq	-48(%rbp), %rdi
	movq	%rbx, %rsi
	movq	%r13, %rdx
	callq	_request_firmware
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %r14d
	leaq	L_.str(%rip), %rsi
	movq	%r13, %rdi
	movq	%rbx, %rdx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_14
LBB0_2:
	movq	-48(%rbp), %rsi
	movq	%r13, %rdi
	callq	_mxt_check_firmware_format
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.3:
	movq	%r15, %rbx
	cmpl	$0, (%r15)
	je	LBB0_7
## %bb.4:
	movl	4(%rbx), %edi
	callq	_enable_irq
LBB0_5:
	addq	$8, %r15
	movq	%r15, %rdi
	callq	_reinit_completion
	movq	_MXT_WAITING_BOOTLOAD_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_mxt_check_bootloader
	testl	%eax, %eax
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	je	LBB0_10
## %bb.6:
	movq	_MXT_WAITING_FRAME_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_mxt_check_bootloader
	jmp	LBB0_11
LBB0_7:
	movl	$1, (%rbx)
	movq	_MXT_COMMAND_RESET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_MXT_BOOT_VALUE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	xorl	%ecx, %ecx
	callq	_mxt_t6_command
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.8:
	movq	_MXT_RESET_TIME@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msleep
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_mxt_lookup_bootloader_address
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.9:
	movq	%rbx, %rdi
	callq	_mxt_free_input_device
	movq	%rbx, %rdi
	callq	_mxt_free_object_table
	jmp	LBB0_5
LBB0_10:
	leaq	L_.str.1(%rip), %rsi
	movq	%r13, %rdi
	callq	_dev_info
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_mxt_send_bootloader_cmd
LBB0_11:
	movl	%eax, %r14d
	testl	%eax, %eax
	je	LBB0_15
LBB0_12:
	movl	4(%rbx), %edi
	callq	_disable_irq
LBB0_13:
	movq	-48(%rbp), %rdi
	callq	_release_firmware
LBB0_14:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	-48(%rbp), %rax
	cmpl	$0, (%rax)
	je	LBB0_25
## %bb.16:
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	xorl	%r12d, %r12d
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_18
LBB0_17:                                ##   in Loop: Header=BB0_18 Depth=1
	movq	-48(%rbp), %rax
	cmpl	(%rax), %r12d
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	jae	LBB0_26
LBB0_18:                                ## =>This Inner Loop Header: Depth=1
	movq	_MXT_WAITING_FRAME_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_mxt_check_bootloader
	testl	%eax, %eax
	jne	LBB0_29
## %bb.19:                              ##   in Loop: Header=BB0_18 Depth=1
	movl	%r15d, -52(%rbp)                ## 4-byte Spill
	movq	-48(%rbp), %rax
	movq	8(%rax), %rax
	movl	%r12d, %r15d
	movl	%r12d, %ecx
	leaq	(%rax,%rcx,4), %rsi
	movl	(%rax,%rcx,4), %r12d
	shll	$8, %r12d
	orl	4(%rax,%rcx,4), %r12d
	addl	$2, %r12d
	movq	%rbx, %rdi
	movl	%r12d, %edx
	callq	_mxt_bootloader_write
	testl	%eax, %eax
	jne	LBB0_29
## %bb.20:                              ##   in Loop: Header=BB0_18 Depth=1
	movq	_MXT_FRAME_CRC_PASS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_mxt_check_bootloader
	testl	%eax, %eax
	je	LBB0_22
## %bb.21:                              ##   in Loop: Header=BB0_18 Depth=1
	movl	%eax, %r14d
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	%eax, %ebx
	incl	%ebx
	leal	4(,%rax,4), %eax
	leal	(%rax,%rax,4), %edi
	callq	_msleep
	movl	%ebx, %eax
	cmpl	$21, %ebx
	movl	%r15d, %r12d
	movl	-52(%rbp), %r15d                ## 4-byte Reload
	jb	LBB0_23
	jmp	LBB0_30
LBB0_22:                                ##   in Loop: Header=BB0_18 Depth=1
	addl	%r12d, %r15d
	movl	%r15d, %r12d
	movl	-52(%rbp), %r15d                ## 4-byte Reload
	incl	%r15d
	xorl	%eax, %eax
LBB0_23:                                ##   in Loop: Header=BB0_18 Depth=1
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	imull	$-1030792151, %r15d, %eax       ## imm = 0xC28F5C29
	rorl	%eax
	cmpl	$85899345, %eax                 ## imm = 0x51EB851
	ja	LBB0_17
## %bb.24:                              ##   in Loop: Header=BB0_18 Depth=1
	movq	-48(%rbp), %rax
	movl	(%rax), %r8d
	movq	%r13, %rdi
	leaq	L_.str.3(%rip), %rsi
	movl	%r15d, %edx
	movl	%r12d, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_17
LBB0_25:
	xorl	%r12d, %r12d
	xorl	%r15d, %r15d
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
LBB0_26:
	movq	_MXT_FW_RESET_TIME@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	callq	_mxt_wait_for_completion
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_12
## %bb.27:
	leaq	L_.str.4(%rip), %rsi
	xorl	%r14d, %r14d
	movq	%r13, %rdi
	movl	%r15d, %edx
	movl	%r12d, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	_MXT_FW_RESET_TIME@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	callq	_mxt_wait_for_completion
	movl	$0, (%rbx)
	jmp	LBB0_12
LBB0_29:
	movl	%eax, %r14d
	jmp	LBB0_12
LBB0_30:
	leaq	L_.str.2(%rip), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unable to open firmware %s\n"

	.comm	_MXT_COMMAND_RESET,4,2          ## @MXT_COMMAND_RESET
	.comm	_MXT_BOOT_VALUE,4,2             ## @MXT_BOOT_VALUE
	.comm	_MXT_RESET_TIME,4,2             ## @MXT_RESET_TIME
	.comm	_MXT_WAITING_BOOTLOAD_CMD,4,2   ## @MXT_WAITING_BOOTLOAD_CMD
	.comm	_MXT_WAITING_FRAME_DATA,4,2     ## @MXT_WAITING_FRAME_DATA
L_.str.1:                               ## @.str.1
	.asciz	"Unlocking bootloader\n"

	.comm	_MXT_FRAME_CRC_PASS,4,2         ## @MXT_FRAME_CRC_PASS
L_.str.2:                               ## @.str.2
	.asciz	"Retry count exceeded\n"

L_.str.3:                               ## @.str.3
	.asciz	"Sent %d frames, %d/%zd bytes\n"

	.comm	_MXT_FW_RESET_TIME,4,2          ## @MXT_FW_RESET_TIME
L_.str.4:                               ## @.str.4
	.asciz	"Sent %d frames, %d bytes\n"

	.no_dead_strip	_mxt_load_fw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mxt_load_fw
_mxt_load_fw:                           ; @mxt_load_fw
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x1
	mov	x20, x0
	bl	_dev_get_drvdata
	mov	x19, x0
	str	xzr, [sp, #8]
	add	x0, sp, #8
	mov	x1, x21
	mov	x2, x20
	bl	_request_firmware
	cbz	w0, LBB0_2
; %bb.1:
	mov	x24, x0
	str	x21, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_dev_err
	b	LBB0_28
LBB0_2:
	ldr	x1, [sp, #8]
	mov	x0, x20
	bl	_mxt_check_firmware_format
	mov	x24, x0
	cbnz	w0, LBB0_27
; %bb.3:
	ldr	w8, [x19]
	cbz	w8, LBB0_7
; %bb.4:
	ldr	w0, [x19, #4]
	bl	_enable_irq
LBB0_5:
	add	x21, x19, #8
	mov	x0, x21
	bl	_reinit_completion
Lloh2:
	adrp	x8, _MXT_WAITING_BOOTLOAD_CMD@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MXT_WAITING_BOOTLOAD_CMD@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_mxt_check_bootloader
	cbz	w0, LBB0_10
; %bb.6:
Lloh5:
	adrp	x8, _MXT_WAITING_FRAME_DATA@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MXT_WAITING_FRAME_DATA@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_mxt_check_bootloader
	mov	x24, x0
	cbnz	w0, LBB0_26
	b	LBB0_11
LBB0_7:
	mov	w8, #1
	str	w8, [x19]
Lloh8:
	adrp	x8, _MXT_COMMAND_RESET@GOTPAGE
Lloh9:
	ldr	x8, [x8, _MXT_COMMAND_RESET@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
Lloh11:
	adrp	x8, _MXT_BOOT_VALUE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _MXT_BOOT_VALUE@GOTPAGEOFF]
Lloh13:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w3, #0
	bl	_mxt_t6_command
	mov	x24, x0
	cbnz	w0, LBB0_27
; %bb.8:
Lloh14:
	adrp	x8, _MXT_RESET_TIME@GOTPAGE
Lloh15:
	ldr	x8, [x8, _MXT_RESET_TIME@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
	bl	_msleep
	mov	x0, x19
	mov	w1, #0
	bl	_mxt_lookup_bootloader_address
	mov	x24, x0
	cbnz	w0, LBB0_27
; %bb.9:
	mov	x0, x19
	bl	_mxt_free_input_device
	mov	x0, x19
	bl	_mxt_free_object_table
	b	LBB0_5
LBB0_10:
Lloh17:
	adrp	x1, l_.str.1@PAGE
Lloh18:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_dev_info
	mov	x0, x19
	mov	w1, #1
	bl	_mxt_send_bootloader_cmd
	mov	x24, x0
	cbnz	w0, LBB0_26
LBB0_11:
	ldr	x8, [sp, #8]
	ldr	w8, [x8]
	cbz	w8, LBB0_21
; %bb.12:
	mov	w23, #0
	mov	w27, #0
	mov	w22, #0
Lloh19:
	adrp	x28, _MXT_WAITING_FRAME_DATA@GOTPAGE
Lloh20:
	ldr	x28, [x28, _MXT_WAITING_FRAME_DATA@GOTPAGEOFF]
Lloh21:
	adrp	x25, _MXT_FRAME_CRC_PASS@GOTPAGE
Lloh22:
	ldr	x25, [x25, _MXT_FRAME_CRC_PASS@GOTPAGEOFF]
	b	LBB0_14
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=1
	ldr	x8, [sp, #8]
	ldr	w8, [x8]
	cmp	w22, w8
	b.hs	LBB0_22
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x28]
	mov	x0, x19
	mov	w2, #1
	bl	_mxt_check_bootloader
	cbnz	w0, LBB0_24
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	x8, [sp, #8]
	ldr	x8, [x8, #8]
	add	x1, x8, w22, uxtw #2
	ldp	w8, w9, [x1]
	orr	w8, w9, w8, lsl #8
	add	w26, w8, #2
	mov	x0, x19
	mov	x2, x26
	bl	_mxt_bootloader_write
	cbnz	w0, LBB0_24
; %bb.16:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	w1, [x25]
	mov	x0, x19
	mov	w2, #1
	bl	_mxt_check_bootloader
	cbz	w0, LBB0_18
; %bb.17:                               ;   in Loop: Header=BB0_14 Depth=1
	mov	x24, x0
	add	w27, w27, #1
	add	w8, w27, w27, lsl #2
	lsl	w0, w8, #2
	bl	_msleep
	cmp	w27, #21
	b.lo	LBB0_19
	b	LBB0_25
LBB0_18:                                ;   in Loop: Header=BB0_14 Depth=1
	mov	w27, #0
	add	w22, w26, w22
	add	w23, w23, #1
LBB0_19:                                ;   in Loop: Header=BB0_14 Depth=1
	mov	w8, #23593
	movk	w8, #49807, lsl #16
	mul	w8, w23, w8
	ror	w8, w8, #1
	mov	w9, #47185
	movk	w9, #1310, lsl #16
	cmp	w8, w9
	b.hi	LBB0_13
; %bb.20:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	x8, [sp, #8]
	ldr	w8, [x8]
	str	x8, [sp]
	mov	x0, x20
Lloh23:
	adrp	x1, l_.str.3@PAGE
Lloh24:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x2, x23
	mov	x3, x22
	bl	_dev_dbg
	b	LBB0_13
LBB0_21:
	mov	w22, #0
	mov	w23, #0
LBB0_22:
Lloh25:
	adrp	x25, _MXT_FW_RESET_TIME@GOTPAGE
Lloh26:
	ldr	x25, [x25, _MXT_FW_RESET_TIME@GOTPAGEOFF]
	ldr	w2, [x25]
	mov	x0, x19
	mov	x1, x21
	bl	_mxt_wait_for_completion
	mov	x24, x0
	cbnz	w0, LBB0_26
; %bb.23:
Lloh27:
	adrp	x1, l_.str.4@PAGE
Lloh28:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x20
	mov	x2, x23
	mov	x3, x22
	bl	_dev_dbg
	ldr	w2, [x25]
	mov	x0, x19
	mov	x1, x21
	bl	_mxt_wait_for_completion
	str	wzr, [x19]
	b	LBB0_26
LBB0_24:
	mov	x24, x0
	b	LBB0_26
LBB0_25:
Lloh29:
	adrp	x1, l_.str.2@PAGE
Lloh30:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_dev_err
LBB0_26:
	ldr	w0, [x19, #4]
	bl	_disable_irq
LBB0_27:
	ldr	x0, [sp, #8]
	bl	_release_firmware
LBB0_28:
	mov	x0, x24
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unable to open firmware %s\n"

	.comm	_MXT_COMMAND_RESET,4,2          ; @MXT_COMMAND_RESET
	.comm	_MXT_BOOT_VALUE,4,2             ; @MXT_BOOT_VALUE
	.comm	_MXT_RESET_TIME,4,2             ; @MXT_RESET_TIME
	.comm	_MXT_WAITING_BOOTLOAD_CMD,4,2   ; @MXT_WAITING_BOOTLOAD_CMD
	.comm	_MXT_WAITING_FRAME_DATA,4,2     ; @MXT_WAITING_FRAME_DATA
l_.str.1:                               ; @.str.1
	.asciz	"Unlocking bootloader\n"

	.comm	_MXT_FRAME_CRC_PASS,4,2         ; @MXT_FRAME_CRC_PASS
l_.str.2:                               ; @.str.2
	.asciz	"Retry count exceeded\n"

l_.str.3:                               ; @.str.3
	.asciz	"Sent %d frames, %d/%zd bytes\n"

	.comm	_MXT_FW_RESET_TIME,4,2          ; @MXT_FW_RESET_TIME
l_.str.4:                               ; @.str.4
	.asciz	"Sent %d frames, %d bytes\n"

	.no_dead_strip	_mxt_load_fw
.subsections_via_symbols
