	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cyapa_pip_write_fw_block
_cyapa_pip_write_fw_block:              ## @cyapa_pip_write_fw_block
	.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	$152, %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, -192(%rbp)                ## 8-byte Spill
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_CYAPA_TSG_MAX_CMD_SIZE@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	shlq	$3, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r14
	movq	(%rbx), %rax
	movq	%rax, -176(%rbp)                ## 8-byte Spill
	leaq	20(%rbx), %rdi
	callq	_get_unaligned_be16
	movq	%rax, -168(%rbp)                ## 8-byte Spill
	leaq	16(%rbx), %rdi
	callq	_get_unaligned_be16
	movq	%rax, %r15
	movq	8(%rbx), %rax
	movq	%rax, -160(%rbp)                ## 8-byte Spill
	movl	(%r12), %edx
	xorl	%r13d, %r13d
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_memset
	leaq	20(%r14), %r12
	movq	_CYAPA_TSG_FLASH_MAP_BLOCK_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	leaq	56(%rbx), %rax
	movq	%rax, -184(%rbp)                ## 8-byte Spill
	movq	_PIP_OUTPUT_REPORT_ADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	leaq	16(%r14), %rsi
	callq	_put_unaligned_le16
	addq	$54, %rbx
	leaq	12(%r14), %rsi
	movq	%rbx, %rdi
	callq	_put_unaligned_le16
	movq	_PIP_BL_CMD_REPORT_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r14)
	movq	_PIP_SOP_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 28(%r14)
	movq	_PIP_BL_CMD_PROGRAM_VERIFY_ROW@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%r14)
	leaq	16(%r15), %rdi
	movq	%r12, %rsi
	callq	_put_unaligned_le16
	movq	(%r14), %rbx
	movq	-176(%rbp), %rax                ## 8-byte Reload
	movq	%rax, 8(%rbx)
	leaq	4(%rbx), %rsi
	movq	-168(%rbp), %rdi                ## 8-byte Reload
	callq	_put_unaligned_le16
	movl	(%rbx), %edi
	movq	-160(%rbp), %rsi                ## 8-byte Reload
	movq	%r15, %rdx
	callq	_memcpy
	movq	(%r14), %rbx
	leaq	28(%r15), %rdx
	movl	$65535, %edi                    ## imm = 0xFFFF
	movq	%r12, %rsi
	callq	_crc_itu_t
	leaq	(%rbx,%r15), %rsi
	addq	$20, %rsi
	movq	%rax, %rdi
	callq	_put_unaligned_le16
	movq	_PIP_EOP_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%rbx,%r15)
	movl	$88, -148(%rbp)
	movq	_cyapa_sort_tsg_pip_bl_resp_data@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leaq	-144(%rbp), %rcx
	leaq	-148(%rbp), %r8
	movq	-192(%rbp), %rdi                ## 8-byte Reload
	movq	%r14, %rsi
	movq	-184(%rbp), %rdx                ## 8-byte Reload
	movl	$500, %r9d                      ## imm = 0x1F4
	pushq	$1
	pushq	%rax
	callq	_cyapa_i2c_pip_cmd_irq_sync
	addq	$16, %rsp
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_4
## %bb.1:
	movl	-148(%rbp), %eax
	movq	_PIP_BL_BLOCK_WRITE_RESP_LEN@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_4
## %bb.2:
	movq	-128(%rbp), %rax
	movq	_PIP_BL_RESP_REPORT_ID@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.3:
	leaq	-144(%rbp), %rdi
	callq	_PIP_CMD_COMPLETE_SUCCESS
	movl	%eax, %ecx
	xorl	%eax, %eax
	testl	%ecx, %ecx
	jne	LBB0_5
LBB0_4:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
	testl	%ebx, %ebx
	cmovsl	%ebx, %r13d
	movl	%r13d, %eax
LBB0_5:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_7
## %bb.6:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_CYAPA_TSG_MAX_CMD_SIZE,4,2     ## @CYAPA_TSG_MAX_CMD_SIZE
	.comm	_CYAPA_TSG_FLASH_MAP_BLOCK_SIZE,8,3 ## @CYAPA_TSG_FLASH_MAP_BLOCK_SIZE
	.comm	_PIP_OUTPUT_REPORT_ADDR,8,3     ## @PIP_OUTPUT_REPORT_ADDR
	.comm	_PIP_BL_CMD_REPORT_ID,4,2       ## @PIP_BL_CMD_REPORT_ID
	.comm	_PIP_SOP_KEY,4,2                ## @PIP_SOP_KEY
	.comm	_PIP_BL_CMD_PROGRAM_VERIFY_ROW,4,2 ## @PIP_BL_CMD_PROGRAM_VERIFY_ROW
	.comm	_PIP_EOP_KEY,4,2                ## @PIP_EOP_KEY
	.comm	_cyapa_sort_tsg_pip_bl_resp_data,4,2 ## @cyapa_sort_tsg_pip_bl_resp_data
	.comm	_PIP_BL_BLOCK_WRITE_RESP_LEN,4,2 ## @PIP_BL_BLOCK_WRITE_RESP_LEN
	.comm	_PIP_BL_RESP_REPORT_ID,8,3      ## @PIP_BL_RESP_REPORT_ID
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.no_dead_strip	_cyapa_pip_write_fw_block
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cyapa_pip_write_fw_block
_cyapa_pip_write_fw_block:              ; @cyapa_pip_write_fw_block
	.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
	sub	sp, sp, #112
	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, #-88]
Lloh3:
	adrp	x25, _CYAPA_TSG_MAX_CMD_SIZE@GOTPAGE
Lloh4:
	ldr	x25, [x25, _CYAPA_TSG_MAX_CMD_SIZE@GOTPAGEOFF]
	ldr	w8, [x25]
	lsl	x8, x8, #3
	mov	x9, x8
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0xffffffff0
	sub	x20, x9, x8
	mov	sp, x20
	ldr	x27, [x1]
	add	x0, x1, #20
	bl	_get_unaligned_be16
	mov	x23, x0
	add	x0, x21, #16
	bl	_get_unaligned_be16
	mov	x22, x0
	ldr	x24, [x21, #8]
	ldr	w2, [x25]
	mov	x0, x20
	mov	w1, #0
	bl	_memset
	add	x25, x20, #20
Lloh7:
	adrp	x8, _CYAPA_TSG_FLASH_MAP_BLOCK_SIZE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _CYAPA_TSG_FLASH_MAP_BLOCK_SIZE@GOTPAGEOFF]
Lloh9:
	ldr	x26, [x8]
	add	x21, x26, #56
Lloh10:
	adrp	x8, _PIP_OUTPUT_REPORT_ADDR@GOTPAGE
Lloh11:
	ldr	x8, [x8, _PIP_OUTPUT_REPORT_ADDR@GOTPAGEOFF]
Lloh12:
	ldr	x0, [x8]
	add	x1, x20, #16
	bl	_put_unaligned_le16
	add	x0, x26, #54
	add	x1, x20, #12
	bl	_put_unaligned_le16
Lloh13:
	adrp	x8, _PIP_BL_CMD_REPORT_ID@GOTPAGE
Lloh14:
	ldr	x8, [x8, _PIP_BL_CMD_REPORT_ID@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	str	w8, [x20, #8]
Lloh16:
	adrp	x8, _PIP_SOP_KEY@GOTPAGE
Lloh17:
	ldr	x8, [x8, _PIP_SOP_KEY@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
Lloh19:
	adrp	x9, _PIP_BL_CMD_PROGRAM_VERIFY_ROW@GOTPAGE
Lloh20:
	ldr	x9, [x9, _PIP_BL_CMD_PROGRAM_VERIFY_ROW@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	stp	w9, w8, [x20, #24]
	add	x26, x22, #16
	mov	x0, x26
	mov	x1, x25
	bl	_put_unaligned_le16
	ldr	x28, [x20]
	str	x27, [x28, #8]
	add	x1, x28, #4
	mov	x0, x23
	bl	_put_unaligned_le16
	ldr	w0, [x28]
	mov	x1, x24
	mov	x2, x22
	bl	_memcpy
	ldr	x8, [x20]
	add	x23, x8, x26
	add	x2, x22, #28
	mov	w0, #65535
	mov	x1, x25
	bl	_crc_itu_t
	add	x1, x23, #4
	bl	_put_unaligned_le16
Lloh22:
	adrp	x8, _PIP_EOP_KEY@GOTPAGE
Lloh23:
	ldr	x8, [x8, _PIP_EOP_KEY@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	str	w8, [x23]
	mov	w8, #88
	stur	w8, [x29, #-180]
Lloh25:
	adrp	x8, _cyapa_sort_tsg_pip_bl_resp_data@GOTPAGE
Lloh26:
	ldr	x8, [x8, _cyapa_sort_tsg_pip_bl_resp_data@GOTPAGEOFF]
Lloh27:
	ldr	w6, [x8]
	sub	x3, x29, #176
	sub	x4, x29, #180
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	mov	w5, #500
	mov	w7, #1
	bl	_cyapa_i2c_pip_cmd_irq_sync
	mov	x19, x0
	cbnz	w0, LBB0_5
; %bb.1:
	ldur	w8, [x29, #-180]
Lloh28:
	adrp	x9, _PIP_BL_BLOCK_WRITE_RESP_LEN@GOTPAGE
Lloh29:
	ldr	x9, [x9, _PIP_BL_BLOCK_WRITE_RESP_LEN@GOTPAGEOFF]
Lloh30:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_5
; %bb.2:
	ldur	x8, [x29, #-160]
Lloh31:
	adrp	x9, _PIP_BL_RESP_REPORT_ID@GOTPAGE
Lloh32:
	ldr	x9, [x9, _PIP_BL_RESP_REPORT_ID@GOTPAGEOFF]
Lloh33:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.3:
	sub	x0, x29, #176
	bl	_PIP_CMD_COMPLETE_SUCCESS
	cbz	w0, LBB0_5
; %bb.4:
	mov	w0, #0
	b	LBB0_6
LBB0_5:
Lloh34:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh35:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh36:
	ldr	w8, [x8]
	cmp	w19, #0
	csneg	w0, w19, w8, lt
LBB0_6:
	ldur	x8, [x29, #-88]
Lloh37:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh38:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh39:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_8
; %bb.7:
	sub	sp, x29, #80
	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
LBB0_8:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.comm	_CYAPA_TSG_MAX_CMD_SIZE,4,2     ; @CYAPA_TSG_MAX_CMD_SIZE
	.comm	_CYAPA_TSG_FLASH_MAP_BLOCK_SIZE,8,3 ; @CYAPA_TSG_FLASH_MAP_BLOCK_SIZE
	.comm	_PIP_OUTPUT_REPORT_ADDR,8,3     ; @PIP_OUTPUT_REPORT_ADDR
	.comm	_PIP_BL_CMD_REPORT_ID,4,2       ; @PIP_BL_CMD_REPORT_ID
	.comm	_PIP_SOP_KEY,4,2                ; @PIP_SOP_KEY
	.comm	_PIP_BL_CMD_PROGRAM_VERIFY_ROW,4,2 ; @PIP_BL_CMD_PROGRAM_VERIFY_ROW
	.comm	_PIP_EOP_KEY,4,2                ; @PIP_EOP_KEY
	.comm	_cyapa_sort_tsg_pip_bl_resp_data,4,2 ; @cyapa_sort_tsg_pip_bl_resp_data
	.comm	_PIP_BL_BLOCK_WRITE_RESP_LEN,4,2 ; @PIP_BL_BLOCK_WRITE_RESP_LEN
	.comm	_PIP_BL_RESP_REPORT_ID,8,3      ; @PIP_BL_RESP_REPORT_ID
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.no_dead_strip	_cyapa_pip_write_fw_block
.subsections_via_symbols
