	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pn544_hci_i2c_fw_secure_write_frame
_pn544_hci_i2c_fw_secure_write_frame:   ## @pn544_hci_i2c_fw_secure_write_frame
	.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
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	(%rdi), %r15
	cmpq	$0, 8(%rdi)
	je	LBB0_2
## %bb.1:
	movl	16(%rbx), %eax
	jmp	LBB0_3
LBB0_2:
	leaq	8(%r15), %rdi
	callq	_get_unaligned_be16
	movq	_PN544_FW_SECURE_FRAME_HEADER_LEN@GOTPCREL(%rip), %rcx
	addl	(%rcx), %eax
	movl	%eax, 16(%rbx)
LBB0_3:
	movq	_PN544_FW_I2C_MAX_PAYLOAD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpl	%ecx, %eax
	jle	LBB0_7
## %bb.4:
	movq	(%r15), %rdx
	movq	_PN544_FW_CMD_SECURE_WRITE@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rdx
	jne	LBB0_5
LBB0_7:
	cmpl	%ecx, %eax
	jge	LBB0_11
## %bb.8:
	movl	36(%rbx), %edi
	movq	(%rbx), %rsi
	movl	%eax, %edx
	callq	_i2c_master_send
	movl	%eax, %r14d
	cmpl	16(%rbx), %eax
	je	LBB0_12
## %bb.9:
	testl	%r14d, %r14d
	js	LBB0_14
## %bb.10:
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_11:
	movq	8(%rbx), %rcx
	movq	(%rbx), %rsi
	addq	%rcx, %rsi
	movslq	%eax, %rdx
	subq	%rcx, %rdx
	movq	%rbx, %rdi
	callq	_pn544_hci_i2c_fw_secure_write_frame_cmd
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_14
LBB0_12:
	movslq	%r14d, %rax
	addq	%rax, 8(%rbx)
	movq	_FW_WORK_STATE_WAIT_SECURE_WRITE_ANSWER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%rbx)
	movq	(%r15), %rax
	movq	_PN544_FW_CMD_RESET@GOTPCREL(%rip), %rcx
	xorl	%r14d, %r14d
	cmpq	(%rcx), %rax
	jne	LBB0_14
## %bb.13:
	movq	_PN544_FW_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_pn544_hci_i2c_enable_mode
	movq	$0, 24(%rbx)
	addq	$20, %rbx
	movq	%rbx, %rdi
	callq	_schedule_work
	jmp	LBB0_14
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_6:
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_14:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PN544_FW_SECURE_FRAME_HEADER_LEN,4,2 ## @PN544_FW_SECURE_FRAME_HEADER_LEN
	.comm	_PN544_FW_I2C_MAX_PAYLOAD,4,2   ## @PN544_FW_I2C_MAX_PAYLOAD
	.comm	_PN544_FW_CMD_SECURE_WRITE,8,3  ## @PN544_FW_CMD_SECURE_WRITE
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EIO,4,2                        ## @EIO
	.comm	_FW_WORK_STATE_WAIT_SECURE_WRITE_ANSWER,4,2 ## @FW_WORK_STATE_WAIT_SECURE_WRITE_ANSWER
	.comm	_PN544_FW_CMD_RESET,8,3         ## @PN544_FW_CMD_RESET
	.comm	_PN544_FW_MODE,4,2              ## @PN544_FW_MODE
	.no_dead_strip	_pn544_hci_i2c_fw_secure_write_frame
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pn544_hci_i2c_fw_secure_write_frame
_pn544_hci_i2c_fw_secure_write_frame:   ; @pn544_hci_i2c_fw_secure_write_frame
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldp	x20, x8, [x0]
	cbz	x8, LBB0_2
; %bb.1:
	ldr	w2, [x19, #16]
	b	LBB0_3
LBB0_2:
	add	x0, x20, #8
	bl	_get_unaligned_be16
Lloh0:
	adrp	x8, _PN544_FW_SECURE_FRAME_HEADER_LEN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PN544_FW_SECURE_FRAME_HEADER_LEN@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	add	w2, w8, w0
	str	w2, [x19, #16]
LBB0_3:
Lloh3:
	adrp	x8, _PN544_FW_I2C_MAX_PAYLOAD@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PN544_FW_I2C_MAX_PAYLOAD@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w2, w8
	b.le	LBB0_5
; %bb.4:
	ldr	x9, [x20]
Lloh6:
	adrp	x10, _PN544_FW_CMD_SECURE_WRITE@GOTPAGE
Lloh7:
	ldr	x10, [x10, _PN544_FW_CMD_SECURE_WRITE@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_13
LBB0_5:
	cmp	w2, w8
	b.ge	LBB0_9
; %bb.6:
	ldr	w0, [x19, #36]
	ldr	x1, [x19]
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_i2c_master_send
	ldr	w8, [x19, #16]
	cmp	w0, w8
	b.eq	LBB0_10
; %bb.7:
	tbnz	w0, #31, LBB0_15
; %bb.8:
Lloh9:
	adrp	x8, _EIO@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_14
LBB0_9:
	ldp	x8, x9, [x19]
	add	x1, x9, x8
	sxtw	x8, w2
	sub	x2, x8, x9
	mov	x0, x19
	bl	_pn544_hci_i2c_fw_secure_write_frame_cmd
	tbnz	w0, #31, LBB0_15
LBB0_10:
	ldr	x8, [x19, #8]
	add	x8, x8, w0, sxtw
	str	x8, [x19, #8]
Lloh11:
	adrp	x8, _FW_WORK_STATE_WAIT_SECURE_WRITE_ANSWER@GOTPAGE
Lloh12:
	ldr	x8, [x8, _FW_WORK_STATE_WAIT_SECURE_WRITE_ANSWER@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	str	w8, [x19, #32]
	ldr	x8, [x20]
Lloh14:
	adrp	x9, _PN544_FW_CMD_RESET@GOTPAGE
Lloh15:
	ldr	x9, [x9, _PN544_FW_CMD_RESET@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_12
; %bb.11:
Lloh17:
	adrp	x8, _PN544_FW_MODE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _PN544_FW_MODE@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_pn544_hci_i2c_enable_mode
	str	xzr, [x19, #24]
	add	x0, x19, #20
	bl	_schedule_work
LBB0_12:
	mov	w0, #0
	b	LBB0_15
LBB0_13:
Lloh20:
	adrp	x8, _EINVAL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_14:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_15:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_PN544_FW_SECURE_FRAME_HEADER_LEN,4,2 ; @PN544_FW_SECURE_FRAME_HEADER_LEN
	.comm	_PN544_FW_I2C_MAX_PAYLOAD,4,2   ; @PN544_FW_I2C_MAX_PAYLOAD
	.comm	_PN544_FW_CMD_SECURE_WRITE,8,3  ; @PN544_FW_CMD_SECURE_WRITE
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EIO,4,2                        ; @EIO
	.comm	_FW_WORK_STATE_WAIT_SECURE_WRITE_ANSWER,4,2 ; @FW_WORK_STATE_WAIT_SECURE_WRITE_ANSWER
	.comm	_PN544_FW_CMD_RESET,8,3         ; @PN544_FW_CMD_RESET
	.comm	_PN544_FW_MODE,4,2              ; @PN544_FW_MODE
	.no_dead_strip	_pn544_hci_i2c_fw_secure_write_frame
.subsections_via_symbols
