	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function xenkbd_connect_backend
_xenkbd_connect_backend:                ## @xenkbd_connect_backend
	.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	%rsi, %r15
	movq	%rdi, %r14
	movl	8(%rdi), %ebx
	movl	8(%rsi), %edi
	callq	_virt_to_gfn
	movl	%ebx, %edi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_gnttab_grant_foreign_access
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_18
## %bb.1:
	movl	%ebx, (%r15)
	leaq	-52(%rbp), %rsi
	movq	%r14, %rdi
	callq	_xenbus_alloc_evtchn
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_5
## %bb.2:
	movl	-52(%rbp), %edi
	movq	_input_handler@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	4(%r14), %ecx
	xorl	%edx, %edx
	movq	%r15, %r8
	callq	_bind_evtchn_to_irqhandler
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_3
## %bb.6:
	movl	%ebx, 4(%r15)
	leaq	L_.str.3(%rip), %r13
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	leaq	-48(%rbp), %rdi
	callq	_xenbus_transaction_start
	testl	%eax, %eax
	jne	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	movl	(%r14), %ebx
	movq	_XENKBD_FIELD_RING_REF@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movl	8(%r15), %edi
	callq	_virt_to_gfn
	movl	-48(%rbp), %edi
	movl	%ebx, %esi
	movl	%r12d, %edx
	leaq	L_.str.2(%rip), %rcx
	movl	%eax, %r8d
	callq	_xenbus_printf
	testl	%eax, %eax
	jne	LBB0_10
## %bb.12:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	(%r14), %esi
	movq	_XENKBD_FIELD_RING_GREF@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	(%r15), %r8d
	movl	-48(%rbp), %edi
	movq	%r13, %rcx
	callq	_xenbus_printf
	testl	%eax, %eax
	jne	LBB0_10
## %bb.13:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	(%r14), %esi
	movq	_XENKBD_FIELD_EVT_CHANNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	-52(%rbp), %r8d
	movl	-48(%rbp), %edi
	movq	%r13, %rcx
	callq	_xenbus_printf
	testl	%eax, %eax
	jne	LBB0_10
## %bb.14:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	-48(%rbp), %edi
	xorl	%esi, %esi
	callq	_xenbus_transaction_end
	testl	%eax, %eax
	je	LBB0_17
## %bb.15:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	%eax, %ebx
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%ebx, %eax
	je	LBB0_7
## %bb.16:
	leaq	L_.str.4(%rip), %rdx
	jmp	LBB0_11
LBB0_3:
	leaq	L_.str(%rip), %rdx
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_xenbus_dev_fatal
	jmp	LBB0_4
LBB0_10:
	movl	%eax, %ebx
	movl	-48(%rbp), %edi
	movl	$1, %esi
	callq	_xenbus_transaction_end
	leaq	L_.str.5(%rip), %rdx
	jmp	LBB0_11
LBB0_8:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdx
LBB0_11:
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_xenbus_dev_fatal
	movl	4(%r15), %edi
	movq	%r15, %rsi
	callq	_unbind_from_irqhandler
	movl	$-1, 4(%r15)
LBB0_4:
	movl	-52(%rbp), %esi
	movq	%r14, %rdi
	callq	_xenbus_free_evtchn
LBB0_5:
	movl	(%r15), %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_gnttab_end_foreign_access
	movl	$-1, (%r15)
LBB0_18:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	movq	_XenbusStateInitialised@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_xenbus_switch_state
	xorl	%ebx, %ebx
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_input_handler,4,2              ## @input_handler
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bind_evtchn_to_irqhandler"

L_.str.1:                               ## @.str.1
	.asciz	"starting transaction"

	.comm	_XENKBD_FIELD_RING_REF,4,2      ## @XENKBD_FIELD_RING_REF
L_.str.2:                               ## @.str.2
	.asciz	"%lu"

	.comm	_XENKBD_FIELD_RING_GREF,4,2     ## @XENKBD_FIELD_RING_GREF
L_.str.3:                               ## @.str.3
	.asciz	"%u"

	.comm	_XENKBD_FIELD_EVT_CHANNEL,4,2   ## @XENKBD_FIELD_EVT_CHANNEL
	.comm	_EAGAIN,4,2                     ## @EAGAIN
L_.str.4:                               ## @.str.4
	.asciz	"completing transaction"

	.comm	_XenbusStateInitialised,4,2     ## @XenbusStateInitialised
L_.str.5:                               ## @.str.5
	.asciz	"writing xenstore"

	.no_dead_strip	_xenkbd_connect_backend
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function xenkbd_connect_backend
_xenkbd_connect_backend:                ; @xenkbd_connect_backend
	.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	x19, x1
	mov	x20, x0
	ldr	w21, [x0, #8]
	ldr	w0, [x1, #8]
	bl	_virt_to_gfn
	mov	x1, x0
	mov	x0, x21
	mov	w2, #0
	bl	_gnttab_grant_foreign_access
	mov	x21, x0
	tbnz	w0, #31, LBB0_17
; %bb.1:
	str	w21, [x19]
	add	x1, sp, #12
	mov	x0, x20
	bl	_xenbus_alloc_evtchn
	mov	x21, x0
	cbnz	w0, LBB0_16
; %bb.2:
	ldr	w0, [sp, #12]
Lloh0:
	adrp	x8, _input_handler@GOTPAGE
Lloh1:
	ldr	x8, [x8, _input_handler@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	ldr	w3, [x20, #4]
	mov	w2, #0
	mov	x4, x19
	bl	_bind_evtchn_to_irqhandler
	mov	x21, x0
	tbnz	w0, #31, LBB0_11
; %bb.3:
	str	w21, [x19, #4]
Lloh3:
	adrp	x25, _XENKBD_FIELD_RING_REF@GOTPAGE
Lloh4:
	ldr	x25, [x25, _XENKBD_FIELD_RING_REF@GOTPAGEOFF]
Lloh5:
	adrp	x22, l_.str.2@PAGE
Lloh6:
	add	x22, x22, l_.str.2@PAGEOFF
Lloh7:
	adrp	x26, _XENKBD_FIELD_RING_GREF@GOTPAGE
Lloh8:
	ldr	x26, [x26, _XENKBD_FIELD_RING_GREF@GOTPAGEOFF]
Lloh9:
	adrp	x23, l_.str.3@PAGE
Lloh10:
	add	x23, x23, l_.str.3@PAGEOFF
Lloh11:
	adrp	x27, _XENKBD_FIELD_EVT_CHANNEL@GOTPAGE
Lloh12:
	ldr	x27, [x27, _XENKBD_FIELD_EVT_CHANNEL@GOTPAGEOFF]
Lloh13:
	adrp	x28, _EAGAIN@GOTPAGE
Lloh14:
	ldr	x28, [x28, _EAGAIN@GOTPAGEOFF]
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	add	x0, sp, #8
	bl	_xenbus_transaction_start
	cbnz	w0, LBB0_13
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w21, [x20]
	ldr	w24, [x25]
	ldr	w0, [x19, #8]
	bl	_virt_to_gfn
	mov	x4, x0
	ldr	w0, [sp, #8]
	mov	x1, x21
	mov	x2, x24
	mov	x3, x22
	bl	_xenbus_printf
	cbnz	w0, LBB0_12
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w1, [x20]
	ldr	w2, [x26]
	ldr	w4, [x19]
	ldr	w0, [sp, #8]
	mov	x3, x23
	bl	_xenbus_printf
	cbnz	w0, LBB0_12
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w1, [x20]
	ldr	w2, [x27]
	ldp	w0, w4, [sp, #8]
	mov	x3, x23
	bl	_xenbus_printf
	cbnz	w0, LBB0_12
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w0, [sp, #8]
	mov	w1, #0
	bl	_xenbus_transaction_end
	mov	x21, x0
	cbz	w0, LBB0_18
; %bb.9:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x28]
	cmn	w21, w8
	b.eq	LBB0_4
; %bb.10:
Lloh15:
	adrp	x2, l_.str.4@PAGE
Lloh16:
	add	x2, x2, l_.str.4@PAGEOFF
	b	LBB0_14
LBB0_11:
Lloh17:
	adrp	x2, l_.str@PAGE
Lloh18:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x20
	mov	x1, x21
	bl	_xenbus_dev_fatal
	b	LBB0_15
LBB0_12:
	mov	x21, x0
	ldr	w0, [sp, #8]
	mov	w1, #1
	bl	_xenbus_transaction_end
Lloh19:
	adrp	x2, l_.str.5@PAGE
Lloh20:
	add	x2, x2, l_.str.5@PAGEOFF
	b	LBB0_14
LBB0_13:
	mov	x21, x0
Lloh21:
	adrp	x2, l_.str.1@PAGE
Lloh22:
	add	x2, x2, l_.str.1@PAGEOFF
LBB0_14:
	mov	x0, x20
	mov	x1, x21
	bl	_xenbus_dev_fatal
	ldr	w0, [x19, #4]
	mov	x1, x19
	bl	_unbind_from_irqhandler
	mov	w8, #-1
	str	w8, [x19, #4]
LBB0_15:
	ldr	w1, [sp, #12]
	mov	x0, x20
	bl	_xenbus_free_evtchn
LBB0_16:
	ldr	w0, [x19]
	mov	w1, #0
	mov	x2, #0
	bl	_gnttab_end_foreign_access
	mov	w8, #-1
	str	w8, [x19]
LBB0_17:
	mov	x0, x21
	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
LBB0_18:
Lloh23:
	adrp	x8, _XenbusStateInitialised@GOTPAGE
Lloh24:
	ldr	x8, [x8, _XenbusStateInitialised@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_xenbus_switch_state
	b	LBB0_17
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_input_handler,4,2              ; @input_handler
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bind_evtchn_to_irqhandler"

l_.str.1:                               ; @.str.1
	.asciz	"starting transaction"

	.comm	_XENKBD_FIELD_RING_REF,4,2      ; @XENKBD_FIELD_RING_REF
l_.str.2:                               ; @.str.2
	.asciz	"%lu"

	.comm	_XENKBD_FIELD_RING_GREF,4,2     ; @XENKBD_FIELD_RING_GREF
l_.str.3:                               ; @.str.3
	.asciz	"%u"

	.comm	_XENKBD_FIELD_EVT_CHANNEL,4,2   ; @XENKBD_FIELD_EVT_CHANNEL
	.comm	_EAGAIN,4,2                     ; @EAGAIN
l_.str.4:                               ; @.str.4
	.asciz	"completing transaction"

	.comm	_XenbusStateInitialised,4,2     ; @XenbusStateInitialised
l_.str.5:                               ; @.str.5
	.asciz	"writing xenstore"

	.no_dead_strip	_xenkbd_connect_backend
.subsections_via_symbols
