	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function port_setup
_port_setup:                            ## @port_setup
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	4(%rdi), %r14d
	testl	%r14d, %r14d
	je	LBB0_1
## %bb.3:
	movq	%rdi, %r12
	movq	_port_cleanup@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 28(%rdi)
	movl	12(%rdi), %eax
	cmpl	$1, %eax
	je	LBB0_4
## %bb.5:
	cmpl	$4, %eax
	je	LBB0_9
## %bb.6:
	cmpl	$2, %eax
	jne	LBB0_8
## %bb.7:
	movq	_port_outw@GOTPCREL(%rip), %rcx
	movq	_port_inw@GOTPCREL(%rip), %rdx
	jmp	LBB0_10
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_4:
	movq	_port_outb@GOTPCREL(%rip), %rcx
	movq	_port_inb@GOTPCREL(%rip), %rdx
	jmp	LBB0_10
LBB0_9:
	movq	_port_outl@GOTPCREL(%rip), %rcx
	movq	_port_inl@GOTPCREL(%rip), %rdx
LBB0_10:
	movl	(%rdx), %edx
	movl	%edx, 20(%r12)
	movl	(%rcx), %ecx
	movl	%ecx, 16(%r12)
	cmpl	$0, (%r12)
	jle	LBB0_11
## %bb.13:
	movq	_DEVICE_NAME@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_request_region
	testq	%rax, %rax
	je	LBB0_14
## %bb.19:
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_20:                                ## =>This Inner Loop Header: Depth=1
	incl	%ebx
	cmpl	(%r12), %ebx
	jge	LBB0_12
## %bb.21:                              ##   in Loop: Header=BB0_20 Depth=1
	movl	12(%r12), %esi
	movl	8(%r12), %edi
	imull	%ebx, %edi
	addl	%r14d, %edi
	movl	(%r13), %edx
	callq	_request_region
	testq	%rax, %rax
	jne	LBB0_20
## %bb.15:
	testl	%ebx, %ebx
	jne	LBB0_16
	jmp	LBB0_18
LBB0_11:
	xorl	%r15d, %r15d
	jmp	LBB0_12
LBB0_8:
	movl	24(%r12), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_warn
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_14:
	xorl	%ebx, %ebx
	testl	%ebx, %ebx
	je	LBB0_18
LBB0_16:
	decl	%ebx
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movl	8(%r12), %edi
	imull	%ebx, %edi
	addl	%r14d, %edi
	movl	12(%r12), %esi
	callq	_release_region
	addl	$-1, %ebx
	jb	LBB0_17
LBB0_18:
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_12:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_port_cleanup,4,2               ## @port_cleanup
	.comm	_port_inb,4,2                   ## @port_inb
	.comm	_port_outb,4,2                  ## @port_outb
	.comm	_port_inw,4,2                   ## @port_inw
	.comm	_port_outw,4,2                  ## @port_outw
	.comm	_port_inl,4,2                   ## @port_inl
	.comm	_port_outl,4,2                  ## @port_outl
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid register size: %d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_DEVICE_NAME,4,2                ## @DEVICE_NAME
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_port_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function port_setup
_port_setup:                            ; @port_setup
	.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
	ldr	w20, [x0, #4]
	cbz	w20, LBB0_5
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x8, _port_cleanup@GOTPAGE
Lloh1:
	ldr	x8, [x8, _port_cleanup@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x0, #28]
	ldr	w8, [x0, #12]
	cmp	w8, #1
	b.eq	LBB0_6
; %bb.2:
	cmp	w8, #4
	b.eq	LBB0_7
; %bb.3:
	cmp	w8, #2
	b.ne	LBB0_17
; %bb.4:
Lloh3:
	adrp	x9, _port_outw@GOTPAGE
Lloh4:
	ldr	x9, [x9, _port_outw@GOTPAGEOFF]
Lloh5:
	adrp	x10, _port_inw@GOTPAGE
Lloh6:
	ldr	x10, [x10, _port_inw@GOTPAGEOFF]
	b	LBB0_8
LBB0_5:
Lloh7:
	adrp	x8, _ENODEV@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
	b	LBB0_18
LBB0_6:
Lloh9:
	adrp	x9, _port_outb@GOTPAGE
Lloh10:
	ldr	x9, [x9, _port_outb@GOTPAGEOFF]
Lloh11:
	adrp	x10, _port_inb@GOTPAGE
Lloh12:
	ldr	x10, [x10, _port_inb@GOTPAGEOFF]
	b	LBB0_8
LBB0_7:
Lloh13:
	adrp	x9, _port_outl@GOTPAGE
Lloh14:
	ldr	x9, [x9, _port_outl@GOTPAGEOFF]
Lloh15:
	adrp	x10, _port_inl@GOTPAGE
Lloh16:
	ldr	x10, [x10, _port_inl@GOTPAGEOFF]
LBB0_8:
	ldr	w10, [x10]
	ldr	w9, [x9]
	stp	w9, w10, [x19, #16]
	ldr	w9, [x19]
	cmp	w9, #1
	b.lt	LBB0_16
; %bb.9:
Lloh17:
	adrp	x21, _DEVICE_NAME@GOTPAGE
Lloh18:
	ldr	x21, [x21, _DEVICE_NAME@GOTPAGEOFF]
	ldr	w2, [x21]
	mov	x0, x20
	mov	x1, x8
	bl	_request_region
	mov	w22, #0
	cbz	x0, LBB0_12
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	add	w22, w22, #1
	ldr	w8, [x19]
	cmp	w22, w8
	b.ge	LBB0_16
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	ldp	w8, w1, [x19, #8]
	madd	w0, w8, w22, w20
	ldr	w2, [x21]
	bl	_request_region
	cbnz	x0, LBB0_10
LBB0_12:
	cbz	w22, LBB0_15
; %bb.13:
	sub	w21, w22, #1
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldp	w8, w1, [x19, #8]
	madd	w0, w8, w21, w20
	bl	_release_region
	sub	w21, w21, #1
	cmn	w21, #1
	b.ne	LBB0_14
LBB0_15:
Lloh19:
	adrp	x8, _EIO@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_18
LBB0_16:
	mov	w0, #0
	b	LBB0_19
LBB0_17:
	ldr	w0, [x19, #24]
Lloh21:
	adrp	x1, l_.str@PAGE
Lloh22:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x8
	bl	_dev_warn
Lloh23:
	adrp	x8, _EINVAL@GOTPAGE
Lloh24:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_18:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_19:
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpAdd	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_port_cleanup,4,2               ; @port_cleanup
	.comm	_port_inb,4,2                   ; @port_inb
	.comm	_port_outb,4,2                  ; @port_outb
	.comm	_port_inw,4,2                   ; @port_inw
	.comm	_port_outw,4,2                  ; @port_outw
	.comm	_port_inl,4,2                   ; @port_inl
	.comm	_port_outl,4,2                  ; @port_outl
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid register size: %d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_DEVICE_NAME,4,2                ; @DEVICE_NAME
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_port_setup
.subsections_via_symbols
