	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function setup_shmem_window
_setup_shmem_window:                    ## @setup_shmem_window
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movl	%edx, %ebx
	movl	%esi, %r15d
	movq	%rdi, %r13
	movq	8(%rdi), %r12
	movq	%r12, %rdi
	callq	_PRIV
	movq	%rax, %r14
	subl	%r15d, %ebx
	shll	$8, %ebx
	cmpl	$32768, %ebx                    ## imm = 0x8000
	movl	$32768, %edi                    ## imm = 0x8000
	cmovll	%ebx, %edi
	movq	%r13, %rbx
	callq	_roundup_pow_of_two
	movl	%eax, %r13d
	movq	_WIN_DATA_WIDTH_16@GOTPCREL(%rip), %rax
	movq	_WIN_MEMORY_TYPE_CM@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	_WIN_ENABLE@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movq	(%rbx), %rax
	movq	24(%rax), %rsi
	orl	(%rsi), %ecx
	movl	%ecx, (%rsi)
	movq	_WIN_USE_WAIT@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, (%rsi)
	movq	$0, 8(%rsi)
	movl	%r13d, 4(%rsi)
	movq	_mem_speed@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_pcmcia_request_window
	movl	$1, %ecx
	testl	%eax, %eax
	jne	LBB0_18
## %bb.1:
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movl	%r15d, %r14d
	shll	$8, %r14d
	addl	-44(%rbp), %r14d                ## 4-byte Folded Reload
	movl	%r14d, %eax
	cltd
	idivl	%r13d
	movl	%edx, %r12d
	movl	%r14d, %r13d
	subl	%edx, %r13d
	movq	(%rbx), %rax
	movq	24(%rax), %rsi
	movq	%rbx, %rdi
	movl	%r13d, %edx
	callq	_pcmcia_map_mem_page
	testl	%eax, %eax
	jne	LBB0_17
## %bb.3:
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	movl	%r15d, -68(%rbp)                ## 4-byte Spill
	movq	(%rbx), %rax
	movq	24(%rax), %rdi
	movq	%rbx, %r13
	movq	8(%rdi), %rbx
	callq	_resource_size
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_ioremap
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	movq	%rax, 8(%r15)
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_17
## %bb.5:
	movq	%r13, -80(%rbp)                 ## 8-byte Spill
	movq	_TX_PAGES@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shll	$8, %eax
	movslq	%r14d, %r14
	movslq	%r12d, %rcx
	movq	%rcx, -88(%rbp)                 ## 8-byte Spill
	testl	%eax, %eax
	jle	LBB0_8
## %bb.6:
	leaq	(,%r14,4), %r12
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	leaq	(,%rax,4), %rax
	subq	%rax, %r12
	xorl	%ebx, %ebx
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r15), %rsi
	addq	%r12, %rsi
	movl	%ebx, %edi
	callq	___raw_writew
	addq	$2, %r13
	movq	_TX_PAGES@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shll	$8, %eax
	cltq
	incl	%ebx
	addq	$8, %r12
	cmpq	%rax, %r13
	jl	LBB0_7
LBB0_8:
	movl	$100, %edi
	callq	_udelay
	movq	_TX_PAGES@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	shll	$8, %eax
	testl	%eax, %eax
	jle	LBB0_13
## %bb.9:
	shlq	$2, %r14
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	shlq	$2, %rax
	subq	%rax, %r14
	movq	$-1, %rbx
	xorl	%r12d, %r12d
	movq	-64(%rbp), %r13                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r13), %rdi
	addq	%r14, %rdi
	callq	___raw_readw
	movl	%eax, %eax
	incq	%rbx
	cmpq	%rax, %rbx
	jne	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	addq	$8, %r14
	addq	$2, %r12
	movl	(%r15), %eax
	shll	$8, %eax
	cltq
	cmpq	%rax, %r12
	jl	LBB0_10
LBB0_12:
	movq	%r15, %r14
	jmp	LBB0_14
LBB0_13:
	movq	%r15, %r14
	xorl	%r12d, %r12d
	movq	-64(%rbp), %r13                 ## 8-byte Reload
LBB0_14:
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_pcnet_reset_8390
	movl	(%r14), %eax
	shll	$8, %eax
	movq	8(%r13), %rdi
	cmpl	%eax, %r12d
	jne	LBB0_16
## %bb.15:
	movslq	-44(%rbp), %rax                 ## 4-byte Folded Reload
	leaq	(%rdi,%rax,4), %rax
	movq	_ei_status@GOTPCREL(%rip), %rbx
	movq	%rax, 32(%rbx)
	movq	(%r15), %rax
	movq	24(%rax), %rdi
	callq	_resource_size
	movl	%eax, (%rbx)
	movq	%r15, %r12
	movq	32(%rbx), %rbx
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	%rbx, (%r15)
	movq	(%r12), %rax
	movq	24(%rax), %rdi
	callq	_resource_size
	cltq
	addq	%rbx, %rax
	movq	%rax, 8(%r15)
	movl	-68(%rbp), %ebx                 ## 4-byte Reload
	movq	_ei_status@GOTPCREL(%rip), %rcx
	movl	%ebx, 4(%rcx)
	movl	(%r14), %eax
	addl	%ebx, %eax
	movl	%eax, 8(%rcx)
	movq	%rcx, %r14
	movq	(%r12), %rax
	movq	24(%rax), %rdi
	callq	_resource_size
	subl	-44(%rbp), %eax                 ## 4-byte Folded Reload
	sarl	$8, %eax
	addl	%ebx, %eax
	movq	%r14, %rcx
	movl	%eax, 12(%r14)
	movq	_shmem_get_8390_hdr@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%r14)
	movq	_shmem_block_input@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%r14)
	movq	_shmem_block_output@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%r14)
	movq	_USE_SHMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%r13)
	xorl	%ecx, %ecx
	jmp	LBB0_18
LBB0_16:
	callq	_iounmap
	movq	(%r15), %rax
	movq	24(%rax), %rsi
	movq	%r15, %rdi
	callq	_pcmcia_release_window
	movq	$0, 8(%r13)
LBB0_17:
	movl	$1, %ecx
LBB0_18:
	movl	%ecx, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_WIN_DATA_WIDTH_16,4,2          ## @WIN_DATA_WIDTH_16
	.comm	_WIN_MEMORY_TYPE_CM,4,2         ## @WIN_MEMORY_TYPE_CM
	.comm	_WIN_ENABLE,4,2                 ## @WIN_ENABLE
	.comm	_WIN_USE_WAIT,4,2               ## @WIN_USE_WAIT
	.comm	_mem_speed,4,2                  ## @mem_speed
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_TX_PAGES,4,2                   ## @TX_PAGES
	.comm	_ei_status,40,3                 ## @ei_status
	.comm	_shmem_get_8390_hdr,4,2         ## @shmem_get_8390_hdr
	.comm	_shmem_block_input,4,2          ## @shmem_block_input
	.comm	_shmem_block_output,4,2         ## @shmem_block_output
	.comm	_USE_SHMEM,4,2                  ## @USE_SHMEM
	.no_dead_strip	_setup_shmem_window
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function setup_shmem_window
_setup_shmem_window:                    ; @setup_shmem_window
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x23, x3
	mov	x24, x2
	mov	x20, x1
	mov	x21, x0
	ldr	x22, [x0, #8]
	mov	x0, x22
	bl	_PRIV
	mov	x19, x0
	sub	w8, w24, w20
	lsl	w8, w8, #8
	mov	w9, #32768
	cmp	w8, #8, lsl #12                 ; =32768
	csel	w0, w8, w9, lt
	bl	_roundup_pow_of_two
	mov	x24, x0
Lloh0:
	adrp	x8, _WIN_DATA_WIDTH_16@GOTPAGE
Lloh1:
	ldr	x8, [x8, _WIN_DATA_WIDTH_16@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _WIN_MEMORY_TYPE_CM@GOTPAGE
Lloh4:
	ldr	x9, [x9, _WIN_MEMORY_TYPE_CM@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
Lloh6:
	adrp	x10, _WIN_ENABLE@GOTPAGE
Lloh7:
	ldr	x10, [x10, _WIN_ENABLE@GOTPAGEOFF]
	orr	w8, w9, w8
Lloh8:
	ldr	w9, [x10]
	orr	w8, w8, w9
	ldr	x9, [x21]
	ldr	x1, [x9, #24]
	ldr	w9, [x1]
	orr	w8, w8, w9
Lloh9:
	adrp	x9, _WIN_USE_WAIT@GOTPAGE
Lloh10:
	ldr	x9, [x9, _WIN_USE_WAIT@GOTPAGEOFF]
	stp	w8, w0, [x1]
Lloh11:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [x1]
	str	xzr, [x1, #8]
Lloh12:
	adrp	x8, _mem_speed@GOTPAGE
Lloh13:
	ldr	x8, [x8, _mem_speed@GOTPAGEOFF]
Lloh14:
	ldr	w2, [x8]
	mov	x0, x21
	bl	_pcmcia_request_window
	cbnz	w0, LBB0_14
; %bb.1:
	add	w26, w23, w20, lsl #8
	sdiv	w8, w26, w24
	mul	w23, w8, w24
	ldr	x8, [x21]
	ldr	x1, [x8, #24]
	mov	x0, x21
	mov	x2, x23
	bl	_pcmcia_map_mem_page
	cbnz	w0, LBB0_14
; %bb.2:
	ldr	x8, [x21]
	ldr	x0, [x8, #24]
	ldr	x24, [x0, #8]
	bl	_resource_size
	mov	x1, x0
	mov	x0, x24
	bl	_ioremap
	str	x0, [x19, #8]
	cmp	x0, #0
	cset	w0, eq
	bl	_unlikely
	cbnz	x0, LBB0_14
; %bb.3:
	sub	w8, w26, w23
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
Lloh15:
	adrp	x25, _TX_PAGES@GOTPAGE
Lloh16:
	ldr	x25, [x25, _TX_PAGES@GOTPAGEOFF]
	ldr	w8, [x25]
	lsl	w8, w8, #8
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.4:
	mov	w24, #0
	mov	x28, #0
	sbfiz	x8, x26, #2, #32
	ldr	w9, [sp, #12]                   ; 4-byte Folded Reload
	sub	x27, x8, w9, sxtw #2
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #8]
	add	x1, x8, x27
	mov	x0, x24
	bl	___raw_writew
	add	x28, x28, #2
	ldr	w8, [x25]
	lsl	w8, w8, #8
	add	w24, w24, #1
	add	x27, x27, #8
	cmp	x28, w8, sxtw
	b.lt	LBB0_5
LBB0_6:
	mov	w0, #100
	bl	_udelay
	ldr	w8, [x25]
	lsl	w8, w8, #8
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.7:
	mov	x24, #0
                                        ; kill: def $w26 killed $w26 killed $x26 def $x26
	sbfiz	x8, x26, #2, #32
	ldr	w9, [sp, #12]                   ; 4-byte Folded Reload
	sub	x26, x8, w9, sxtw #2
	mov	x27, #-1
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #8]
	add	x0, x8, x26
	bl	___raw_readw
	add	x27, x27, #1
	cmp	x27, w0, uxtw
	b.ne	LBB0_11
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	add	x26, x26, #8
	add	x24, x24, #2
	ldr	w8, [x25]
	lsl	w8, w8, #8
	cmp	x24, w8, sxtw
	b.lt	LBB0_8
	b	LBB0_11
LBB0_10:
	mov	w24, #0
LBB0_11:
	mov	x0, x22
	bl	_pcnet_reset_8390
	ldr	w8, [x25]
	ldr	x0, [x19, #8]
	cmp	w24, w8, lsl #8
	b.ne	LBB0_13
; %bb.12:
	add	x8, x0, w23, sxtw #2
Lloh17:
	adrp	x24, _ei_status@GOTPAGE
Lloh18:
	ldr	x24, [x24, _ei_status@GOTPAGEOFF]
	str	x8, [x24, #32]
	ldr	x8, [x21]
	ldr	x0, [x8, #24]
	bl	_resource_size
	str	w0, [x24]
	ldr	x26, [x24, #32]
	str	x26, [x22]
	ldr	x8, [x21]
	ldr	x0, [x8, #24]
	bl	_resource_size
	add	x8, x26, w0, sxtw
	str	x8, [x22, #8]
	ldr	w8, [x25]
	add	w8, w8, w20
	stp	w20, w8, [x24, #4]
	ldr	x8, [x21]
	ldr	x0, [x8, #24]
	bl	_resource_size
	mov	x8, x0
	mov	w0, #0
	sub	w8, w8, w23
Lloh19:
	adrp	x9, _shmem_get_8390_hdr@GOTPAGE
Lloh20:
	ldr	x9, [x9, _shmem_get_8390_hdr@GOTPAGEOFF]
	add	w8, w20, w8, asr #8
Lloh21:
	ldr	w9, [x9]
Lloh22:
	adrp	x10, _shmem_block_input@GOTPAGE
Lloh23:
	ldr	x10, [x10, _shmem_block_input@GOTPAGEOFF]
Lloh24:
	ldr	w10, [x10]
	stp	w10, w9, [x24, #20]
Lloh25:
	adrp	x9, _shmem_block_output@GOTPAGE
Lloh26:
	ldr	x9, [x9, _shmem_block_output@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	stp	w8, w9, [x24, #12]
Lloh28:
	adrp	x8, _USE_SHMEM@GOTPAGE
Lloh29:
	ldr	x8, [x8, _USE_SHMEM@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	ldr	w9, [x19]
	orr	w8, w9, w8
	str	w8, [x19]
	b	LBB0_15
LBB0_13:
	bl	_iounmap
	ldr	x8, [x21]
	ldr	x1, [x8, #24]
	mov	x0, x21
	bl	_pcmcia_release_window
	str	xzr, [x19, #8]
LBB0_14:
	mov	w0, #1
LBB0_15:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_WIN_DATA_WIDTH_16,4,2          ; @WIN_DATA_WIDTH_16
	.comm	_WIN_MEMORY_TYPE_CM,4,2         ; @WIN_MEMORY_TYPE_CM
	.comm	_WIN_ENABLE,4,2                 ; @WIN_ENABLE
	.comm	_WIN_USE_WAIT,4,2               ; @WIN_USE_WAIT
	.comm	_mem_speed,4,2                  ; @mem_speed
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_TX_PAGES,4,2                   ; @TX_PAGES
	.comm	_ei_status,40,3                 ; @ei_status
	.comm	_shmem_get_8390_hdr,4,2         ; @shmem_get_8390_hdr
	.comm	_shmem_block_input,4,2          ; @shmem_block_input
	.comm	_shmem_block_output,4,2         ; @shmem_block_output
	.comm	_USE_SHMEM,4,2                  ; @USE_SHMEM
	.no_dead_strip	_setup_shmem_window
.subsections_via_symbols
