	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tunopen
_tunopen:                               ## @tunopen
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r14
	movq	%rdi, %r15
	movl	$0, -36(%rbp)
	movq	%rcx, %rdi
	callq	_TD_TO_VNET
	movl	%eax, %edi
	callq	_CURVNET_SET
	movl	8(%r15), %edi
	leaq	-36(%rbp), %rdx
	xorl	%esi, %esi
	callq	_tuntap_name2info
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %ebx
LBB0_10:
	xorl	%eax, %eax
	callq	_CURVNET_RESTORE
LBB0_11:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	(%r15), %rbx
	xorl	%edi, %edi
	testq	%rbx, %rbx
	setne	%dil
	leaq	L_.str(%rip), %rsi
	callq	_KASSERT
	movq	%rbx, %rdi
	callq	_TUN_LOCK
	movl	(%rbx), %eax
	movq	_TUN_INITED@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_3
## %bb.4:
	movq	_TUN_OPEN@GOTPCREL(%rip), %r12
	movq	_TUN_DYING@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%r12), %ecx
	testl	%eax, %ecx
	je	LBB0_6
## %bb.5:
	movq	%rbx, %rdi
	callq	_TUN_UNLOCK
	xorl	%eax, %eax
	callq	_CURVNET_RESTORE
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_11
LBB0_3:
	movq	%rbx, %rdi
	callq	_TUN_UNLOCK
	xorl	%eax, %eax
	callq	_CURVNET_RESTORE
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_11
LBB0_6:
	movq	%rbx, %rdi
	callq	_tun_busy_locked
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	leaq	L_.str.1(%rip), %rsi
	callq	_KASSERT
	movq	%rbx, %rdi
	callq	_TUN2IFP
	movq	%rax, %r15
	movq	_TUN_L2@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_9
## %bb.7:
	movq	%r15, %rdi
	callq	_IF_LLADDR
	movl	8(%rbx), %esi
	movl	%eax, %edi
	movl	$4, %edx
	callq	_bcopy
	movq	_IFF_DRV_RUNNING@GOTPCREL(%rip), %rax
	movl	4(%r15), %ecx
	orl	(%rax), %ecx
	movq	_IFF_DRV_OACTIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	andl	%ecx, %eax
	movl	%eax, 4(%r15)
	movq	_tapuponopen@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_9
## %bb.8:
	movq	_IFF_UP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%r15)
LBB0_9:
	movq	(%r14), %rax
	movl	(%rax), %eax
	movl	%eax, 4(%rbx)
	movl	(%r12), %eax
	orl	%eax, (%rbx)
	movq	_LINK_STATE_UP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_if_link_state_change
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdi
	callq	_TUNDEBUG
	movq	%rbx, %rdi
	callq	_TUN_UNLOCK
	movq	_tundtor@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_devfs_set_cdevpriv
	xorl	%ebx, %ebx
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"si_drv1 should have been initialized at creation"

	.comm	_TUN_INITED,4,2                 ## @TUN_INITED
	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_TUN_OPEN,4,2                   ## @TUN_OPEN
	.comm	_TUN_DYING,4,2                  ## @TUN_DYING
	.comm	_EBUSY,4,2                      ## @EBUSY
L_.str.1:                               ## @.str.1
	.asciz	"Must be able to busy an unopen tunnel"

	.comm	_TUN_L2,4,2                     ## @TUN_L2
	.comm	_IFF_DRV_RUNNING,4,2            ## @IFF_DRV_RUNNING
	.comm	_IFF_DRV_OACTIVE,4,2            ## @IFF_DRV_OACTIVE
	.comm	_tapuponopen,8,3                ## @tapuponopen
	.comm	_IFF_UP,4,2                     ## @IFF_UP
	.comm	_LINK_STATE_UP,4,2              ## @LINK_STATE_UP
L_.str.2:                               ## @.str.2
	.asciz	"open\n"

	.comm	_tundtor,4,2                    ## @tundtor
	.no_dead_strip	_tunopen
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tunopen
_tunopen:                               ; @tunopen
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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, x3
	mov	x19, x0
	str	wzr, [sp, #12]
	mov	x0, x3
	bl	_TD_TO_VNET
	bl	_CURVNET_SET
	ldr	w0, [x19, #8]
	add	x2, sp, #12
	mov	x1, #0
	bl	_tuntap_name2info
	cbz	w0, LBB0_3
; %bb.1:
	mov	x21, x0
	bl	_CURVNET_RESTORE
LBB0_2:
	mov	x0, x21
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_3:
	ldr	x19, [x19]
	cmp	x19, #0
	cset	w0, ne
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_KASSERT
	mov	x0, x19
	bl	_TUN_LOCK
	ldr	w8, [x19]
Lloh2:
	adrp	x9, _TUN_INITED@GOTPAGE
Lloh3:
	ldr	x9, [x9, _TUN_INITED@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.4:
Lloh5:
	adrp	x22, _TUN_OPEN@GOTPAGE
Lloh6:
	ldr	x22, [x22, _TUN_OPEN@GOTPAGEOFF]
	ldr	w9, [x22]
Lloh7:
	adrp	x10, _TUN_DYING@GOTPAGE
Lloh8:
	ldr	x10, [x10, _TUN_DYING@GOTPAGEOFF]
Lloh9:
	ldr	w10, [x10]
	orr	w9, w10, w9
	tst	w9, w8
	b.eq	LBB0_7
; %bb.5:
	mov	x0, x19
	bl	_TUN_UNLOCK
	bl	_CURVNET_RESTORE
Lloh10:
	adrp	x8, _EBUSY@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh12:
	ldr	w21, [x8]
	b	LBB0_2
LBB0_6:
	mov	x0, x19
	bl	_TUN_UNLOCK
	bl	_CURVNET_RESTORE
Lloh13:
	adrp	x8, _ENXIO@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh15:
	ldr	w21, [x8]
	b	LBB0_2
LBB0_7:
	mov	x0, x19
	bl	_tun_busy_locked
	cmp	w0, #0
	cset	w0, eq
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_KASSERT
	mov	x0, x19
	bl	_TUN2IFP
	mov	x21, x0
	ldr	w8, [x19]
Lloh18:
	adrp	x9, _TUN_L2@GOTPAGE
Lloh19:
	ldr	x9, [x9, _TUN_L2@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.8:
	mov	x0, x21
	bl	_IF_LLADDR
	ldr	w1, [x19, #8]
	mov	w2, #4
	bl	_bcopy
Lloh21:
	adrp	x8, _IFF_DRV_RUNNING@GOTPAGE
Lloh22:
	ldr	x8, [x8, _IFF_DRV_RUNNING@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	ldr	w9, [x21, #4]
	orr	w8, w9, w8
Lloh24:
	adrp	x9, _IFF_DRV_OACTIVE@GOTPAGE
Lloh25:
	ldr	x9, [x9, _IFF_DRV_OACTIVE@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	bic	w8, w8, w9
	str	w8, [x21, #4]
Lloh27:
	adrp	x8, _tapuponopen@GOTPAGE
Lloh28:
	ldr	x8, [x8, _tapuponopen@GOTPAGEOFF]
Lloh29:
	ldr	x8, [x8]
	cbz	x8, LBB0_10
; %bb.9:
Lloh30:
	adrp	x8, _IFF_UP@GOTPAGE
Lloh31:
	ldr	x8, [x8, _IFF_UP@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	ldr	w9, [x21]
	orr	w8, w9, w8
	str	w8, [x21]
LBB0_10:
	ldr	x8, [x20]
	ldr	w8, [x8]
	ldr	w9, [x22]
	ldr	w10, [x19]
	orr	w9, w10, w9
	stp	w9, w8, [x19]
Lloh33:
	adrp	x8, _LINK_STATE_UP@GOTPAGE
Lloh34:
	ldr	x8, [x8, _LINK_STATE_UP@GOTPAGEOFF]
Lloh35:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_if_link_state_change
Lloh36:
	adrp	x1, l_.str.2@PAGE
Lloh37:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x21
	bl	_TUNDEBUG
	mov	x0, x19
	bl	_TUN_UNLOCK
Lloh38:
	adrp	x8, _tundtor@GOTPAGE
Lloh39:
	ldr	x8, [x8, _tundtor@GOTPAGEOFF]
Lloh40:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_devfs_set_cdevpriv
	bl	_CURVNET_RESTORE
	mov	w21, #0
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"si_drv1 should have been initialized at creation"

	.comm	_TUN_INITED,4,2                 ; @TUN_INITED
	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_TUN_OPEN,4,2                   ; @TUN_OPEN
	.comm	_TUN_DYING,4,2                  ; @TUN_DYING
	.comm	_EBUSY,4,2                      ; @EBUSY
l_.str.1:                               ; @.str.1
	.asciz	"Must be able to busy an unopen tunnel"

	.comm	_TUN_L2,4,2                     ; @TUN_L2
	.comm	_IFF_DRV_RUNNING,4,2            ; @IFF_DRV_RUNNING
	.comm	_IFF_DRV_OACTIVE,4,2            ; @IFF_DRV_OACTIVE
	.comm	_tapuponopen,8,3                ; @tapuponopen
	.comm	_IFF_UP,4,2                     ; @IFF_UP
	.comm	_LINK_STATE_UP,4,2              ; @LINK_STATE_UP
l_.str.2:                               ; @.str.2
	.asciz	"open\n"

	.comm	_tundtor,4,2                    ; @tundtor
	.no_dead_strip	_tunopen
.subsections_via_symbols
