	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cw1200_apb_write               ## -- Begin function cw1200_apb_write
	.p2align	4, 0x90
_cw1200_apb_write:                      ## @cw1200_apb_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpq	$8192, %rcx                     ## imm = 0x2000
	jb	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_2:
	movq	%rcx, %r15
	movq	%rdx, %r12
	movl	%esi, %ebx
	movq	%rdi, %r14
	movq	8(%rdi), %rax
	movl	(%rdi), %edi
	callq	*8(%rax)
	movq	_ST90TDS_SRAM_BASE_ADDR_REG_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	___cw1200_reg_write_32
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movq	_ST90TDS_SRAM_DPORT_REG_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movq	%r12, %rdx
	movq	%r15, %rcx
	xorl	%r8d, %r8d
	callq	___cw1200_reg_write
	movl	%eax, %ebx
	testl	%eax, %eax
	jns	LBB0_7
## %bb.5:
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_6
LBB0_3:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdi
LBB0_6:
	callq	_pr_err
LBB0_7:
	movq	8(%r14), %rax
	movl	(%r14), %edi
	callq	*(%rax)
LBB0_8:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Can't write more than 0xfff words.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ST90TDS_SRAM_BASE_ADDR_REG_ID,4,2 ## @ST90TDS_SRAM_BASE_ADDR_REG_ID
L_.str.1:                               ## @.str.1
	.asciz	"Can't write address register.\n"

	.comm	_ST90TDS_SRAM_DPORT_REG_ID,4,2  ## @ST90TDS_SRAM_DPORT_REG_ID
L_.str.2:                               ## @.str.2
	.asciz	"Can't write data port.\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cw1200_apb_write               ; -- Begin function cw1200_apb_write
	.p2align	2
_cw1200_apb_write:                      ; @cw1200_apb_write
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	cmp	x3, #2, lsl #12                 ; =8192
	b.lo	LBB0_2
; %bb.1:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_8
LBB0_2:
	mov	x21, x3
	mov	x22, x2
	mov	x20, x1
	mov	x19, x0
	ldr	x8, [x0, #8]
	ldr	x8, [x8, #8]
	ldr	w0, [x0]
	blr	x8
Lloh5:
	adrp	x8, _ST90TDS_SRAM_BASE_ADDR_REG_ID@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ST90TDS_SRAM_BASE_ADDR_REG_ID@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	bl	___cw1200_reg_write_32
	tbnz	w0, #31, LBB0_5
; %bb.3:
Lloh8:
	adrp	x8, _ST90TDS_SRAM_DPORT_REG_ID@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ST90TDS_SRAM_DPORT_REG_ID@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x22
	mov	x3, x21
	mov	w4, #0
	bl	___cw1200_reg_write
	mov	x20, x0
	tbz	w0, #31, LBB0_7
; %bb.4:
Lloh11:
	adrp	x0, l_.str.2@PAGE
Lloh12:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_6
LBB0_5:
	mov	x20, x0
Lloh13:
	adrp	x0, l_.str.1@PAGE
Lloh14:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_6:
	bl	_pr_err
LBB0_7:
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	ldr	w0, [x19]
	blr	x8
LBB0_8:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Can't write more than 0xfff words.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ST90TDS_SRAM_BASE_ADDR_REG_ID,4,2 ; @ST90TDS_SRAM_BASE_ADDR_REG_ID
l_.str.1:                               ; @.str.1
	.asciz	"Can't write address register.\n"

	.comm	_ST90TDS_SRAM_DPORT_REG_ID,4,2  ; @ST90TDS_SRAM_DPORT_REG_ID
l_.str.2:                               ; @.str.2
	.asciz	"Can't write data port.\n"

.subsections_via_symbols
