	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_xenbusb_add_device             ## -- Begin function xenbusb_add_device
	.p2align	4, 0x90
_xenbusb_add_device:                    ## @xenbusb_add_device
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r12
	movq	%rsi, %r13
	movq	%rdi, %r15
	callq	_device_get_softc
	movq	%rax, %rbx
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_sbuf_new_auto
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	8(%rbx), %edx
	leaq	L_.str(%rip), %rsi
	movq	%rax, %rdi
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	movq	%r13, %rcx
	movq	%rax, %r13
	movq	%r12, %r8
	callq	_sbuf_printf
	movq	%r13, %rdi
	callq	_sbuf_finish
	movq	%r13, %rdi
	callq	_sbuf_data
	movq	%rax, %r12
	movq	_M_XENBUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_M_ZERO@GOTPCREL(%rip), %rax
	movq	_M_WAITOK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movl	$112, %edi
	callq	_malloc
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_XST_NIL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rdx
	movq	%r12, %rsi
	callq	_xs_exists
	testq	%rax, %rax
	je	LBB0_8
## %bb.1:
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_xenbusb_device_exists
	testq	%rax, %rax
	jne	LBB0_7
## %bb.2:
	movq	%r12, %rdi
	callq	_xenbus_read_driver_state
	movq	_XenbusStateInitialising@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_3
## %bb.4:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	addq	$104, %rdi
	leaq	L_.str.3(%rip), %rsi
	callq	_sx_init
	movq	_XDF_CONNECTING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 100(%rbx)
	movq	_M_XENBUS@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	%r12, %rdi
	callq	_strdup
	movq	%rax, 48(%rbx)
	movq	%r12, %rdi
	callq	_strlen
	movl	%eax, 96(%rbx)
	movl	(%r14), %esi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_strdup
	movq	%rax, 88(%rbx)
	movq	_XenbusStateInitialising@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	%rbx, %r14
	movl	%eax, (%rbx)
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_XENBUSB_GET_OTHEREND_NODE
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	movl	%eax, %ebx
	leaq	L_.str.4(%rip), %rdi
	movq	%r12, %rsi
	xorl	%eax, %eax
	callq	_printf
	movq	%r13, %rdi
	callq	_sbuf_delete
	jmp	LBB0_9
LBB0_8:
	movq	%r13, %rdi
	callq	_sbuf_delete
	testl	%ebx, %ebx
	je	LBB0_10
LBB0_9:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_xenbusb_free_child_ivars
	movl	%ebx, %r14d
	jmp	LBB0_10
LBB0_3:
	leaq	L_.str.2(%rip), %rdi
	movq	%r12, %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_printf
	jmp	LBB0_7
LBB0_6:
	movq	%r14, %rbx
	movl	80(%r14), %r14d
	leaq	L_.str.5(%rip), %rdi
	callq	_strlen
                                        ## kill: def $eax killed $eax def $rax
	leal	(%r14,%rax), %edi
	incl	%edi
	movq	_M_XENBUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_M_WAITOK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_malloc
	movq	%rax, %r14
	movq	8(%rbx), %rdx
	leaq	L_.str.6(%rip), %rsi
	movq	%rax, %rdi
	callq	_sprintf
	movq	%r14, 56(%rbx)
	movq	_xenbusb_otherend_watch_cb@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 72(%rbx)
	movq	%rbx, 64(%rbx)
	movq	48(%rbx), %rax
	movq	%rax, 40(%rbx)
	movq	_xenbusb_local_watch_cb@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%rbx)
	movq	%rbx, 24(%rbx)
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	callq	_mtx_lock
	incl	4(%r14)
	movq	%r14, %rdi
	callq	_mtx_unlock
	movq	%r15, %rdi
	xorl	%esi, %esi
	movl	$-1, %edx
	callq	_device_add_child
	movq	%rax, 16(%rbx)
	movq	%rax, %rdi
	movq	%rbx, %rsi
	callq	_device_set_ivars
LBB0_7:
	movq	%r13, %rdi
	callq	_sbuf_delete
	xorl	%r14d, %r14d
LBB0_10:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s/%s/%s"

	.comm	_M_XENBUS,4,2                   ## @M_XENBUS
	.comm	_M_ZERO,4,2                     ## @M_ZERO
	.comm	_M_WAITOK,4,2                   ## @M_WAITOK
	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_XST_NIL,4,2                    ## @XST_NIL
L_.str.1:                               ## @.str.1
	.space	1

	.comm	_XenbusStateInitialising,4,2    ## @XenbusStateInitialising
L_.str.2:                               ## @.str.2
	.asciz	"xenbusb_add_device: Device %s ignored. State %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"xdlock"

	.comm	_XDF_CONNECTING,4,2             ## @XDF_CONNECTING
L_.str.4:                               ## @.str.4
	.asciz	"xenbus_update_device: %s no otherend id\n"

L_.str.5:                               ## @.str.5
	.asciz	"/state"

L_.str.6:                               ## @.str.6
	.asciz	"%s/state"

	.comm	_xenbusb_otherend_watch_cb,4,2  ## @xenbusb_otherend_watch_cb
	.comm	_xenbusb_local_watch_cb,4,2     ## @xenbusb_local_watch_cb
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_xenbusb_add_device             ; -- Begin function xenbusb_add_device
	.p2align	2
_xenbusb_add_device:                    ; @xenbusb_add_device
	.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	x21, x2
	mov	x23, x1
	mov	x20, x0
	bl	_device_get_softc
	mov	x22, x0
	bl	_sbuf_new_auto
	mov	x19, x0
	ldr	w2, [x22, #8]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x3, x23
	mov	x4, x21
	bl	_sbuf_printf
	mov	x0, x19
	bl	_sbuf_finish
	mov	x0, x19
	bl	_sbuf_data
	mov	x24, x0
Lloh2:
	adrp	x26, _M_XENBUS@GOTPAGE
Lloh3:
	ldr	x26, [x26, _M_XENBUS@GOTPAGEOFF]
Lloh4:
	adrp	x8, _M_ZERO@GOTPAGE
Lloh5:
	ldr	x8, [x8, _M_ZERO@GOTPAGEOFF]
	ldr	w1, [x26]
Lloh6:
	ldr	w8, [x8]
Lloh7:
	adrp	x27, _M_WAITOK@GOTPAGE
Lloh8:
	ldr	x27, [x27, _M_WAITOK@GOTPAGEOFF]
	ldr	w9, [x27]
	orr	w2, w9, w8
	mov	w0, #112
	bl	_malloc
	mov	x21, x0
Lloh9:
	adrp	x8, _ENXIO@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh11:
	ldr	w25, [x8]
Lloh12:
	adrp	x8, _XST_NIL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _XST_NIL@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
Lloh15:
	adrp	x2, l_.str.1@PAGE
Lloh16:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x1, x24
	bl	_xs_exists
	cbz	x0, LBB0_5
; %bb.1:
	mov	x0, x20
	mov	x1, x24
	bl	_xenbusb_device_exists
	cbnz	x0, LBB0_9
; %bb.2:
	mov	x0, x24
	bl	_xenbus_read_driver_state
                                        ; kill: def $w0 killed $w0 def $x0
Lloh17:
	adrp	x25, _XenbusStateInitialising@GOTPAGE
Lloh18:
	ldr	x25, [x25, _XenbusStateInitialising@GOTPAGEOFF]
	ldr	w8, [x25]
	cmp	w0, w8
	b.ne	LBB0_7
; %bb.3:
	add	x0, x21, #104
Lloh19:
	adrp	x1, l_.str.3@PAGE
Lloh20:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_sx_init
Lloh21:
	adrp	x8, _XDF_CONNECTING@GOTPAGE
Lloh22:
	ldr	x8, [x8, _XDF_CONNECTING@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	str	w8, [x21, #100]
	ldr	w1, [x26]
	mov	x0, x24
	bl	_strdup
	str	x0, [x21, #48]
	mov	x0, x24
	bl	_strlen
	str	w0, [x21, #96]
	ldr	w1, [x26]
	mov	x0, x23
	bl	_strdup
	str	x0, [x21, #88]
	ldr	w8, [x25]
	str	w8, [x21]
	mov	x0, x20
	mov	x1, x21
	bl	_XENBUSB_GET_OTHEREND_NODE
	cbz	w0, LBB0_8
; %bb.4:
	mov	x25, x0
Lloh24:
	adrp	x0, l_.str.4@PAGE
Lloh25:
	add	x0, x0, l_.str.4@PAGEOFF
	mov	x1, x24
	bl	_printf
	mov	x0, x19
	bl	_sbuf_delete
	b	LBB0_6
LBB0_5:
	mov	x0, x19
	bl	_sbuf_delete
	cbz	w25, LBB0_10
LBB0_6:
	mov	x0, x21
	bl	_xenbusb_free_child_ivars
	b	LBB0_10
LBB0_7:
	str	x0, [sp]
Lloh26:
	adrp	x0, l_.str.2@PAGE
Lloh27:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x24
	bl	_printf
	b	LBB0_9
LBB0_8:
	ldr	w23, [x21, #80]
Lloh28:
	adrp	x0, l_.str.5@PAGE
Lloh29:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_strlen
	add	w8, w23, w0
	add	w0, w8, #1
	ldr	w1, [x26]
	ldr	w2, [x27]
	bl	_malloc
	mov	x23, x0
	ldr	x2, [x21, #8]
Lloh30:
	adrp	x1, l_.str.6@PAGE
Lloh31:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_sprintf
Lloh32:
	adrp	x8, _xenbusb_otherend_watch_cb@GOTPAGE
Lloh33:
	ldr	x8, [x8, _xenbusb_otherend_watch_cb@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	str	w8, [x21, #72]
	stp	x23, x21, [x21, #56]
	ldr	x8, [x21, #48]
	str	x8, [x21, #40]
Lloh35:
	adrp	x8, _xenbusb_local_watch_cb@GOTPAGE
Lloh36:
	ldr	x8, [x8, _xenbusb_local_watch_cb@GOTPAGEOFF]
Lloh37:
	ldr	w8, [x8]
	str	w8, [x21, #32]
	str	x21, [x21, #24]
	mov	x0, x22
	bl	_mtx_lock
	ldr	w8, [x22, #4]
	add	w8, w8, #1
	str	w8, [x22, #4]
	mov	x0, x22
	bl	_mtx_unlock
	mov	x0, x20
	mov	x1, #0
	mov	w2, #-1
	bl	_device_add_child
	str	x0, [x21, #16]
	mov	x1, x21
	bl	_device_set_ivars
LBB0_9:
	mov	x0, x19
	bl	_sbuf_delete
	mov	w25, #0
LBB0_10:
	mov	x0, x25
	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 AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s/%s/%s"

	.comm	_M_XENBUS,4,2                   ; @M_XENBUS
	.comm	_M_ZERO,4,2                     ; @M_ZERO
	.comm	_M_WAITOK,4,2                   ; @M_WAITOK
	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_XST_NIL,4,2                    ; @XST_NIL
l_.str.1:                               ; @.str.1
	.space	1

	.comm	_XenbusStateInitialising,4,2    ; @XenbusStateInitialising
l_.str.2:                               ; @.str.2
	.asciz	"xenbusb_add_device: Device %s ignored. State %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"xdlock"

	.comm	_XDF_CONNECTING,4,2             ; @XDF_CONNECTING
l_.str.4:                               ; @.str.4
	.asciz	"xenbus_update_device: %s no otherend id\n"

l_.str.5:                               ; @.str.5
	.asciz	"/state"

l_.str.6:                               ; @.str.6
	.asciz	"%s/state"

	.comm	_xenbusb_otherend_watch_cb,4,2  ; @xenbusb_otherend_watch_cb
	.comm	_xenbusb_local_watch_cb,4,2     ; @xenbusb_local_watch_cb
.subsections_via_symbols
