	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function iqs5xx_bl_write
_iqs5xx_bl_write:                       ## @iqs5xx_bl_write
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r13d
	movq	%rdx, -96(%rbp)                 ## 8-byte Spill
	movl	%esi, %r15d
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movq	%rsp, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_IQS5XX_BL_BLK_LEN_MAX@GOTPCREL(%rip), %r12
	movslq	(%r12), %rbx
	leaq	16(,%rbx,4), %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %rsi
	movl	%r13d, %eax
	cltd
	idivl	(%r12)
	testl	%edx, %edx
	je	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_10
LBB0_2:
	movq	%r15, -88(%rbp)                 ## 8-byte Spill
	addq	$4, %rbx
	movq	_IQS5XX_BL_ADDR_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	xorl	(%rdx), %eax
	movl	%eax, -120(%rbp)
	movq	$0, -104(%rbp)
	shll	$2, %ebx
	movl	%ebx, -116(%rbp)
	movq	%rsi, -112(%rbp)
	testl	%r13d, %r13d
	jle	LBB0_3
## %bb.4:
	movl	%r13d, -60(%rbp)                ## 4-byte Spill
	movq	%r14, -72(%rbp)                 ## 8-byte Spill
	movq	%rsi, %rax
	addq	$16, %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	addl	$-4, %ebx
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	leal	(%rax,%r13), %r14d
	movl	%r14d, %edi
	movq	%rsi, %r15
	callq	_put_unaligned_be16
	movslq	%r13d, %rax
	movq	-96(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rax,4), %rsi
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %edx
	callq	_memcpy
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	8(%rax), %edi
	leaq	-120(%rbp), %rsi
	movl	$1, %edx
	callq	_i2c_transfer
	cmpl	$1, %eax
	jne	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	$10000, %edi                    ## imm = 0x2710
	movl	$10100, %esi                    ## imm = 0x2774
	callq	_usleep_range
	addl	(%r12), %r13d
	cmpl	-60(%rbp), %r13d                ## 4-byte Folded Reload
	movq	%r15, %rsi
	jl	LBB0_5
## %bb.7:
	xorl	%ebx, %ebx
	jmp	LBB0_9
LBB0_3:
	xorl	%ebx, %ebx
	jmp	LBB0_10
LBB0_8:
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%ebx, %ebx
	subl	(%rcx), %ebx
	testl	%eax, %eax
	cmovsl	%eax, %ebx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	addq	$4, %rdi
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	movl	%ebx, %ecx
	callq	_dev_err
LBB0_9:
	movq	-72(%rbp), %r14                 ## 8-byte Reload
LBB0_10:
	movq	%r14, %rsp
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_12
## %bb.11:
	movl	%ebx, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_IQS5XX_BL_BLK_LEN_MAX,4,2      ## @IQS5XX_BL_BLK_LEN_MAX
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_IQS5XX_BL_ADDR_MASK,4,2        ## @IQS5XX_BL_ADDR_MASK
	.comm	_EIO,4,2                        ## @EIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to write block at address 0x%04X: %d\n"

	.no_dead_strip	_iqs5xx_bl_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function iqs5xx_bl_write
_iqs5xx_bl_write:                       ; @iqs5xx_bl_write
	.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, #48
	mov	x20, x3
	mov	x21, x2
	mov	x22, x1
	mov	x19, x0
	mov	x13, sp
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	x28, _IQS5XX_BL_BLK_LEN_MAX@GOTPAGE
Lloh4:
	ldr	x28, [x28, _IQS5XX_BL_BLK_LEN_MAX@GOTPAGEOFF]
	ldrsw	x8, [x28]
	add	x12, x8, #4
	lsl	x8, x12, #2
	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, #0xfffffffffffffff0
	sub	x23, x9, x8
	mov	sp, x23
	ldr	w8, [x28]
	sdiv	w9, w3, w8
	msub	w8, w9, w8, w3
	cbz	w8, LBB0_2
; %bb.1:
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_10
LBB0_2:
	ldr	w8, [x19]
Lloh10:
	adrp	x9, _IQS5XX_BL_ADDR_MASK@GOTPAGE
Lloh11:
	ldr	x9, [x9, _IQS5XX_BL_ADDR_MASK@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	eor	w9, w9, w8
	lsl	w8, w12, #2
	stp	w9, w8, [x29, #-112]
	stp	x23, xzr, [x29, #-104]
	cmp	w20, #1
	b.lt	LBB0_7
; %bb.3:
	stur	x13, [x29, #-120]               ; 8-byte Folded Spill
	mov	w27, #0
	add	x24, x23, #16
	sub	w25, w8, #4
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	add	w26, w27, w22
	mov	x0, x26
	mov	x1, x23
	bl	_put_unaligned_be16
	add	x1, x21, w27, sxtw #2
	mov	x0, x24
	mov	x2, x25
	bl	_memcpy
	ldr	w0, [x19, #8]
	sub	x1, x29, #112
	mov	w2, #1
	bl	_i2c_transfer
	cmp	w0, #1
	b.ne	LBB0_8
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w0, #10000
	mov	w1, #10100
	bl	_usleep_range
	ldr	w8, [x28]
	add	w27, w8, w27
	cmp	w27, w20
	b.lt	LBB0_4
; %bb.6:
	mov	w20, #0
	b	LBB0_9
LBB0_7:
	mov	w20, #0
	b	LBB0_10
LBB0_8:
Lloh13:
	adrp	x8, _EIO@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	cmp	w0, #0
	csneg	w20, w0, w8, lt
	add	x0, x19, #4
Lloh16:
	adrp	x1, l_.str@PAGE
Lloh17:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x26
	mov	x3, x20
	bl	_dev_err
LBB0_9:
	ldur	x13, [x29, #-120]               ; 8-byte Folded Reload
LBB0_10:
	mov	sp, x13
	ldur	x8, [x29, #-88]
Lloh18:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh19:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_12
; %bb.11:
	mov	x0, x20
	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_12:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_IQS5XX_BL_BLK_LEN_MAX,4,2      ; @IQS5XX_BL_BLK_LEN_MAX
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_IQS5XX_BL_ADDR_MASK,4,2        ; @IQS5XX_BL_ADDR_MASK
	.comm	_EIO,4,2                        ; @EIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to write block at address 0x%04X: %d\n"

	.no_dead_strip	_iqs5xx_bl_write
.subsections_via_symbols
