	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nes_init_csr_ne020
_nes_init_csr_ne020:                    ## @nes_init_csr_ne020
	.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
	movl	%edx, %r14d
	movl	%esi, %r15d
	movq	%rdi, %rbx
	movq	_NES_DBG_INIT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_nes_debug
	movq	%rbx, %rdi
	movl	$484, %esi                      ## imm = 0x1E4
	movl	$7, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$488, %esi                      ## imm = 0x1E8
	movl	$133236, %edx                   ## imm = 0x20874
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$472, %esi                      ## imm = 0x1D8
	movl	$294914, %edx                   ## imm = 0x48002
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$508, %esi                      ## imm = 0x1FC
	movl	$327685, %edx                   ## imm = 0x50005
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$1536, %esi                     ## imm = 0x600
	movl	$1431655765, %edx               ## imm = 0x55555555
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$1540, %esi                     ## imm = 0x604
	movl	$1431655765, %edx               ## imm = 0x55555555
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$8192, %esi                     ## imm = 0x2000
	movl	$1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$8196, %esi                     ## imm = 0x2004
	movl	$1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$8200, %esi                     ## imm = 0x2008
	movl	$65535, %edx                    ## imm = 0xFFFF
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$8204, %esi                     ## imm = 0x200C
	movl	$1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$8208, %esi                     ## imm = 0x2010
	movl	$961, %edx                      ## imm = 0x3C1
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$8220, %esi                     ## imm = 0x201C
	movl	$1966364280, %edx               ## imm = 0x75345678
	callq	_nes_write_indexed
	cmpl	$2, %r14d
	jl	LBB0_3
## %bb.1:
	movq	%rbx, %rdi
	movl	$8704, %esi                     ## imm = 0x2200
	movl	$1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$8708, %esi                     ## imm = 0x2204
	movl	$1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$8712, %esi                     ## imm = 0x2208
	movl	$65535, %edx                    ## imm = 0xFFFF
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$8716, %esi                     ## imm = 0x220C
	movl	$1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$8720, %esi                     ## imm = 0x2210
	movl	$961, %edx                      ## imm = 0x3C1
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$8732, %esi                     ## imm = 0x221C
	movl	$1966364280, %edx               ## imm = 0x75345678
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$2312, %esi                     ## imm = 0x908
	movl	$536870913, %edx                ## imm = 0x20000001
	callq	_nes_write_indexed
	cmpl	$2, %r14d
	je	LBB0_3
## %bb.2:
	movq	%rbx, %rdi
	movl	$9216, %esi                     ## imm = 0x2400
	movl	$1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$9220, %esi                     ## imm = 0x2404
	movl	$1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$9224, %esi                     ## imm = 0x2408
	movl	$65535, %edx                    ## imm = 0xFFFF
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$9228, %esi                     ## imm = 0x240C
	movl	$1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$9232, %esi                     ## imm = 0x2410
	movl	$961, %edx                      ## imm = 0x3C1
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$9244, %esi                     ## imm = 0x241C
	movl	$1966364280, %edx               ## imm = 0x75345678
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$2320, %esi                     ## imm = 0x910
	movl	$536870913, %edx                ## imm = 0x20000001
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$9728, %esi                     ## imm = 0x2600
	movl	$1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$9732, %esi                     ## imm = 0x2604
	movl	$1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$9736, %esi                     ## imm = 0x2608
	movl	$65535, %edx                    ## imm = 0xFFFF
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$9740, %esi                     ## imm = 0x260C
	movl	$1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$9744, %esi                     ## imm = 0x2610
	movl	$961, %edx                      ## imm = 0x3C1
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$9756, %esi                     ## imm = 0x261C
	movl	$1966364280, %edx               ## imm = 0x75345678
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$2328, %esi                     ## imm = 0x918
	movl	$536870913, %edx                ## imm = 0x20000001
	callq	_nes_write_indexed
LBB0_3:
	movq	%rbx, %rdi
	movl	$20480, %esi                    ## imm = 0x5000
	movl	$98304, %edx                    ## imm = 0x18000
	callq	_nes_write_indexed
	movq	_NES_IDX_WQM_CONFIG1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_wqm_quanta@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leal	(%rax,%rax), %edx
	incl	%edx
	movq	%rbx, %rdi
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$20488, %esi                    ## imm = 0x5008
	movl	$522133279, %edx                ## imm = 0x1F1F1F1F
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$20496, %esi                    ## imm = 0x5010
	movl	$522133279, %edx                ## imm = 0x1F1F1F1F
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$20504, %esi                    ## imm = 0x5018
	movl	$522133279, %edx                ## imm = 0x1F1F1F1F
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$20512, %esi                    ## imm = 0x5020
	movl	$522133279, %edx                ## imm = 0x1F1F1F1F
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$24720, %esi                    ## imm = 0x6090
	movl	$-1, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$2304, %esi                     ## imm = 0x900
	movl	$536870913, %edx                ## imm = 0x20000001
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$24768, %esi                    ## imm = 0x60C0
	movl	$654, %edx                      ## imm = 0x28E
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$24776, %esi                    ## imm = 0x60C8
	movl	$32, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$492, %esi                      ## imm = 0x1EC
	movl	$2066097568, %edx               ## imm = 0x7B2625A0
	callq	_nes_write_indexed
	movq	_NE020_REV@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	je	LBB0_5
## %bb.4:
	movq	%rbx, %rdi
	movl	$2280, %esi                     ## imm = 0x8E8
	callq	_nes_read_indexed
	orl	$-2147483648, %eax              ## imm = 0x80000000
	movq	%rbx, %rdi
	movl	$2280, %esi                     ## imm = 0x8E8
	movl	%eax, %edx
	callq	_nes_write_indexed
	movq	%rbx, %rdi
	movl	$8696, %esi                     ## imm = 0x21F8
	callq	_nes_read_indexed
	orl	$2147418128, %eax               ## imm = 0x7FFF0010
	andl	$2147483647, %eax               ## imm = 0x7FFFFFFF
	movq	%rbx, %rdi
	movl	$8696, %esi                     ## imm = 0x21F8
	movl	%eax, %edx
	callq	_nes_write_indexed
	cmpl	$2, %r14d
	jl	LBB0_5
## %bb.6:
	movq	%rbx, %rdi
	movl	$9208, %esi                     ## imm = 0x23F8
	callq	_nes_read_indexed
	orl	$2147418128, %eax               ## imm = 0x7FFF0010
	andl	$2147483647, %eax               ## imm = 0x7FFFFFFF
	movq	%rbx, %rdi
	movl	$9208, %esi                     ## imm = 0x23F8
	movl	%eax, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_nes_write_indexed              ## TAILCALL
LBB0_5:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NES_DBG_INIT,4,2               ## @NES_DBG_INIT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"port_count=%d\n"

	.comm	_NES_IDX_WQM_CONFIG1,4,2        ## @NES_IDX_WQM_CONFIG1
	.comm	_wqm_quanta,4,2                 ## @wqm_quanta
	.comm	_NE020_REV,4,2                  ## @NE020_REV
	.no_dead_strip	_nes_init_csr_ne020
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nes_init_csr_ne020
_nes_init_csr_ne020:                    ; @nes_init_csr_ne020
	.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
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _NES_DBG_INIT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NES_DBG_INIT@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_nes_debug
	mov	x0, x19
	mov	w1, #484
	mov	w2, #7
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #488
	mov	w2, #2164
	movk	w2, #2, lsl #16
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #472
	mov	w2, #32770
	movk	w2, #4, lsl #16
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #508
	mov	w2, #5
	movk	w2, #5, lsl #16
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #1536
	mov	w2, #1431655765
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #1540
	mov	w2, #1431655765
	bl	_nes_write_indexed
	mov	w22, #1
	mov	x0, x19
	mov	w1, #8192
	mov	w2, #1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #8196
	mov	w2, #1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #8200
	mov	w2, #65535
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #8204
	mov	w2, #1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #8208
	mov	w2, #961
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #8220
	mov	w2, #22136
	movk	w2, #30004, lsl #16
	bl	_nes_write_indexed
	cmp	w20, #2
	b.lt	LBB0_3
; %bb.1:
	mov	x0, x19
	mov	w1, #8704
	mov	w2, #1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #8708
	mov	w2, #1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #8712
	mov	w2, #65535
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #8716
	mov	w2, #1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #8720
	mov	w2, #961
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #8732
	mov	w2, #22136
	movk	w2, #30004, lsl #16
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #2312
	mov	w2, #1
	movk	w2, #8192, lsl #16
	bl	_nes_write_indexed
	cmp	w20, #2
	b.eq	LBB0_3
; %bb.2:
	mov	x0, x19
	mov	w1, #9216
	mov	w2, #1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #9220
	mov	w2, #1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #9224
	mov	w2, #65535
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #9228
	mov	w2, #1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #9232
	mov	w2, #961
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #9244
	mov	w2, #22136
	movk	w2, #30004, lsl #16
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #2320
	mov	w2, #1
	movk	w2, #8192, lsl #16
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #9728
	mov	w2, #1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #9732
	mov	w2, #1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #9736
	mov	w2, #65535
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #9740
	mov	w2, #1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #9744
	mov	w2, #961
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #9756
	mov	w2, #22136
	movk	w2, #30004, lsl #16
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #2328
	mov	w2, #1
	movk	w2, #8192, lsl #16
	bl	_nes_write_indexed
LBB0_3:
	mov	x0, x19
	mov	w1, #20480
	mov	w2, #98304
	bl	_nes_write_indexed
Lloh5:
	adrp	x8, _NES_IDX_WQM_CONFIG1@GOTPAGE
Lloh6:
	ldr	x8, [x8, _NES_IDX_WQM_CONFIG1@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
Lloh8:
	adrp	x8, _wqm_quanta@GOTPAGE
Lloh9:
	ldr	x8, [x8, _wqm_quanta@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	bfi	w22, w8, #1, #31
	mov	x0, x19
	mov	x2, x22
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #20488
	mov	w2, #522133279
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #20496
	mov	w2, #522133279
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #20504
	mov	w2, #522133279
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #20512
	mov	w2, #522133279
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #24720
	mov	w2, #-1
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #2304
	mov	w2, #1
	movk	w2, #8192, lsl #16
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #24768
	mov	w2, #654
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #24776
	mov	w2, #32
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #492
	mov	w2, #9632
	movk	w2, #31526, lsl #16
	bl	_nes_write_indexed
Lloh11:
	adrp	x8, _NE020_REV@GOTPAGE
Lloh12:
	ldr	x8, [x8, _NE020_REV@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	cmp	w8, w21
	b.eq	LBB0_6
; %bb.4:
	mov	w21, #16
	movk	w21, #32767, lsl #16
	mov	x0, x19
	mov	w1, #2280
	bl	_nes_read_indexed
	orr	w2, w0, #0x80000000
	mov	x0, x19
	mov	w1, #2280
	bl	_nes_write_indexed
	mov	x0, x19
	mov	w1, #8696
	bl	_nes_read_indexed
	and	w8, w0, #0x7fffffff
	orr	w2, w8, w21
	mov	x0, x19
	mov	w1, #8696
	bl	_nes_write_indexed
	cmp	w20, #2
	b.lt	LBB0_6
; %bb.5:
	mov	x0, x19
	mov	w1, #9208
	bl	_nes_read_indexed
	mov	w8, #65519
	and	w8, w0, w8
	orr	w2, w8, w21
	mov	x0, x19
	mov	w1, #9208
	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
	b	_nes_write_indexed
LBB0_6:
	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 AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_NES_DBG_INIT,4,2               ; @NES_DBG_INIT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"port_count=%d\n"

	.comm	_NES_IDX_WQM_CONFIG1,4,2        ; @NES_IDX_WQM_CONFIG1
	.comm	_wqm_quanta,4,2                 ; @wqm_quanta
	.comm	_NE020_REV,4,2                  ; @NE020_REV
	.no_dead_strip	_nes_init_csr_ne020
.subsections_via_symbols
