	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cyapa_pip_bl_initiate          ## -- Begin function cyapa_pip_bl_initiate
	.p2align	4, 0x90
_cyapa_pip_bl_initiate:                 ## @cyapa_pip_bl_initiate
	.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	$136, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r13
	movq	%rdi, %rbx
	movq	%rdi, -168(%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), %r14
	movl	(%r14), %eax
	shlq	$3, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r12
	movq	%rbx, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_cyapa_empty_pip_output_data
	movl	(%r14), %edx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_memset
	movq	_CYAPA_TSG_BL_KEY_SIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movq	_CYAPA_TSG_FLASH_MAP_BLOCK_SIZE@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rbx
	addq	%rax, %rbx
	leal	40(%rbx), %eax
	movl	%eax, -152(%rbp)                ## 4-byte Spill
	movq	_PIP_OUTPUT_REPORT_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	28(%r12), %rsi
	callq	_put_unaligned_le16
	leal	38(%rbx), %edi
	leaq	24(%r12), %rsi
	callq	_put_unaligned_le16
	movq	_PIP_BL_CMD_REPORT_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%r12)
	leaq	8(%r12), %r15
	movq	_PIP_SOP_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%r12)
	movq	_PIP_BL_CMD_INITIATE_BL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%r12)
	movl	%ebx, %edi
	movq	%r15, %rsi
	callq	_put_unaligned_le16
	movq	(%r12), %r14
	movq	(%r14), %rdi
	movq	_cyapa_pip_bl_cmd_key@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	_CYAPA_TSG_BL_KEY_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_memcpy
	leaq	-156(%rbp), %rsi
	movq	%r13, %rdi
	callq	_cyapa_get_image_record_data_num
	movslq	-156(%rbp), %rcx
	movq	-8(%rax,%rcx,8), %rsi
	movq	8(%r14), %rdi
	movq	_CYAPA_TSG_FLASH_MAP_METADATA_SIZE@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	callq	_memcpy
	movq	8(%r14), %rsi
	movl	(%r13), %edx
	movl	$65535, %edi                    ## imm = 0xFFFF
	callq	_crc_itu_t
	addq	$16, %r14
	movl	%eax, %edi
	movq	%r14, %rsi
	callq	_put_unaligned_le16
	movq	(%r12), %r14
	leal	12(%rbx), %edx
	movl	$65535, %edi                    ## imm = 0xFFFF
	movq	%r15, %rsi
	callq	_crc_itu_t
	leaq	(%r14,%rbx), %rsi
	addq	$4, %rsi
	movl	%eax, %edi
	callq	_put_unaligned_le16
	movq	_PIP_EOP_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r14,%rbx)
	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	-168(%rbp), %rdi                ## 8-byte Reload
	movq	%r12, %rsi
	movl	-152(%rbp), %edx                ## 4-byte Reload
	movl	$12000, %r9d                    ## imm = 0x2EE0
	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_INITIATE_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
	xorl	%ecx, %ecx
	subl	(%rax), %ecx
	testl	%ebx, %ebx
	cmovnel	%ebx, %ecx
	movl	%ecx, %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_BL_KEY_SIZE,4,2      ## @CYAPA_TSG_BL_KEY_SIZE
	.comm	_CYAPA_TSG_FLASH_MAP_BLOCK_SIZE,4,2 ## @CYAPA_TSG_FLASH_MAP_BLOCK_SIZE
	.comm	_PIP_OUTPUT_REPORT_ADDR,4,2     ## @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_INITIATE_BL,4,2     ## @PIP_BL_CMD_INITIATE_BL
	.comm	_cyapa_pip_bl_cmd_key,8,3       ## @cyapa_pip_bl_cmd_key
	.comm	_CYAPA_TSG_FLASH_MAP_METADATA_SIZE,4,2 ## @CYAPA_TSG_FLASH_MAP_METADATA_SIZE
	.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_INITIATE_RESP_LEN,4,2   ## @PIP_BL_INITIATE_RESP_LEN
	.comm	_PIP_BL_RESP_REPORT_ID,8,3      ## @PIP_BL_RESP_REPORT_ID
	.comm	_EAGAIN,4,2                     ## @EAGAIN
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cyapa_pip_bl_initiate          ; -- Begin function cyapa_pip_bl_initiate
	.p2align	2
_cyapa_pip_bl_initiate:                 ; @cyapa_pip_bl_initiate
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	sub	sp, sp, #112
	mov	x22, 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, #-72]
Lloh3:
	adrp	x21, _CYAPA_TSG_MAX_CMD_SIZE@GOTPAGE
Lloh4:
	ldr	x21, [x21, _CYAPA_TSG_MAX_CMD_SIZE@GOTPAGEOFF]
	ldr	w8, [x21]
	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
	mov	x1, #0
	mov	x2, #0
	mov	x3, #0
	bl	_cyapa_empty_pip_output_data
	ldr	w2, [x21]
	mov	x0, x20
	mov	w1, #0
	bl	_memset
Lloh7:
	adrp	x25, _CYAPA_TSG_BL_KEY_SIZE@GOTPAGE
Lloh8:
	ldr	x25, [x25, _CYAPA_TSG_BL_KEY_SIZE@GOTPAGEOFF]
	ldrsw	x8, [x25]
Lloh9:
	adrp	x9, _CYAPA_TSG_FLASH_MAP_BLOCK_SIZE@GOTPAGE
Lloh10:
	ldr	x9, [x9, _CYAPA_TSG_FLASH_MAP_BLOCK_SIZE@GOTPAGEOFF]
Lloh11:
	ldrsw	x9, [x9]
	add	x23, x9, x8
	add	w21, w23, #40
Lloh12:
	adrp	x8, _PIP_OUTPUT_REPORT_ADDR@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PIP_OUTPUT_REPORT_ADDR@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	add	x1, x20, #28
	bl	_put_unaligned_le16
	add	w0, w23, #38
	add	x1, x20, #24
	bl	_put_unaligned_le16
Lloh15:
	adrp	x8, _PIP_BL_CMD_REPORT_ID@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PIP_BL_CMD_REPORT_ID@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	str	w8, [x20, #20]
	add	x24, x20, #8
Lloh18:
	adrp	x8, _PIP_SOP_KEY@GOTPAGE
Lloh19:
	ldr	x8, [x8, _PIP_SOP_KEY@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
Lloh21:
	adrp	x9, _PIP_BL_CMD_INITIATE_BL@GOTPAGE
Lloh22:
	ldr	x9, [x9, _PIP_BL_CMD_INITIATE_BL@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	stp	w9, w8, [x20, #12]
	mov	x0, x23
	mov	x1, x24
	bl	_put_unaligned_le16
	ldr	x26, [x20]
	ldr	x0, [x26]
Lloh24:
	adrp	x8, _cyapa_pip_bl_cmd_key@GOTPAGE
Lloh25:
	ldr	x8, [x8, _cyapa_pip_bl_cmd_key@GOTPAGEOFF]
Lloh26:
	ldr	x1, [x8]
	ldr	w2, [x25]
	bl	_memcpy
	sub	x1, x29, #168
	mov	x0, x22
	bl	_cyapa_get_image_record_data_num
	ldursw	x8, [x29, #-168]
	add	x8, x0, x8, lsl #3
	ldur	x1, [x8, #-8]
	ldr	x0, [x26, #8]
Lloh27:
	adrp	x22, _CYAPA_TSG_FLASH_MAP_METADATA_SIZE@GOTPAGE
Lloh28:
	ldr	x22, [x22, _CYAPA_TSG_FLASH_MAP_METADATA_SIZE@GOTPAGEOFF]
	ldr	w2, [x22]
	bl	_memcpy
	ldr	x1, [x26, #8]
	ldr	w2, [x22]
	mov	w0, #65535
	bl	_crc_itu_t
	add	x1, x26, #16
	bl	_put_unaligned_le16
	ldr	x8, [x20]
	add	x22, x8, x23
	add	w2, w23, #12
	mov	w0, #65535
	mov	x1, x24
	bl	_crc_itu_t
	add	x1, x22, #4
	bl	_put_unaligned_le16
Lloh29:
	adrp	x8, _PIP_EOP_KEY@GOTPAGE
Lloh30:
	ldr	x8, [x8, _PIP_EOP_KEY@GOTPAGEOFF]
Lloh31:
	ldr	w8, [x8]
	str	w8, [x22]
	mov	w8, #88
	stur	w8, [x29, #-164]
Lloh32:
	adrp	x8, _cyapa_sort_tsg_pip_bl_resp_data@GOTPAGE
Lloh33:
	ldr	x8, [x8, _cyapa_sort_tsg_pip_bl_resp_data@GOTPAGEOFF]
Lloh34:
	ldr	w6, [x8]
	sub	x3, x29, #160
	sub	x4, x29, #164
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	mov	w5, #12000
	mov	w7, #1
	bl	_cyapa_i2c_pip_cmd_irq_sync
	mov	x19, x0
	cbnz	w0, LBB0_5
; %bb.1:
	ldur	w8, [x29, #-164]
Lloh35:
	adrp	x9, _PIP_BL_INITIATE_RESP_LEN@GOTPAGE
Lloh36:
	ldr	x9, [x9, _PIP_BL_INITIATE_RESP_LEN@GOTPAGEOFF]
Lloh37:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_5
; %bb.2:
	ldur	x8, [x29, #-144]
Lloh38:
	adrp	x9, _PIP_BL_RESP_REPORT_ID@GOTPAGE
Lloh39:
	ldr	x9, [x9, _PIP_BL_RESP_REPORT_ID@GOTPAGEOFF]
Lloh40:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.3:
	sub	x0, x29, #160
	bl	_PIP_CMD_COMPLETE_SUCCESS
	cbz	w0, LBB0_5
; %bb.4:
	mov	w0, #0
	b	LBB0_6
LBB0_5:
Lloh41:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh42:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh43:
	ldr	w8, [x8]
	cmp	w19, #0
	csneg	w0, w19, w8, ne
LBB0_6:
	ldur	x8, [x29, #-72]
Lloh44:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh45:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh46:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_8
; %bb.7:
	sub	sp, x29, #64
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_8:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.cfi_endproc
                                        ; -- End function
	.comm	_CYAPA_TSG_MAX_CMD_SIZE,4,2     ; @CYAPA_TSG_MAX_CMD_SIZE
	.comm	_CYAPA_TSG_BL_KEY_SIZE,4,2      ; @CYAPA_TSG_BL_KEY_SIZE
	.comm	_CYAPA_TSG_FLASH_MAP_BLOCK_SIZE,4,2 ; @CYAPA_TSG_FLASH_MAP_BLOCK_SIZE
	.comm	_PIP_OUTPUT_REPORT_ADDR,4,2     ; @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_INITIATE_BL,4,2     ; @PIP_BL_CMD_INITIATE_BL
	.comm	_cyapa_pip_bl_cmd_key,8,3       ; @cyapa_pip_bl_cmd_key
	.comm	_CYAPA_TSG_FLASH_MAP_METADATA_SIZE,4,2 ; @CYAPA_TSG_FLASH_MAP_METADATA_SIZE
	.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_INITIATE_RESP_LEN,4,2   ; @PIP_BL_INITIATE_RESP_LEN
	.comm	_PIP_BL_RESP_REPORT_ID,8,3      ; @PIP_BL_RESP_REPORT_ID
	.comm	_EAGAIN,4,2                     ; @EAGAIN
.subsections_via_symbols
