	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_qib_reset_device               ## -- Begin function qib_reset_device
	.p2align	4, 0x90
_qib_reset_device:                      ## @qib_reset_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
	movl	%edi, %ebx
	callq	_qib_lookup
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movq	%rax, %r12
	movl	24(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	callq	_qib_devinfo
	cmpl	$0, 64(%r12)
	je	LBB0_5
## %bb.4:
	movq	_QIB_PRESENT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_5
## %bb.6:
	movq	%r12, %r15
	addq	$48, %r15
	movq	%r15, %rdi
	callq	_spin_lock_irqsave
	movq	56(%r12), %rcx
	testq	%rcx, %rcx
	je	LBB0_13
## %bb.7:
	movslq	4(%r12), %rdx
	movl	8(%r12), %eax
	cmpl	%eax, %edx
	jge	LBB0_13
## %bb.8:
	leaq	(%rcx,%rdx,8), %rcx
	subl	%edx, %eax
	xorl	%edx, %edx
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_9 Depth=1
	incq	%rdx
	cmpl	%edx, %eax
	je	LBB0_13
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%rcx,%rdx,8), %rsi
	testq	%rsi, %rsi
	je	LBB0_12
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	cmpl	$0, (%rsi)
	je	LBB0_12
## %bb.11:
	movq	%r15, %rdi
	callq	_spin_unlock_irqrestore
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_5:
	movl	24(%r12), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edx
	callq	_qib_devinfo
	movq	_ENXIO@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_26:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movq	%r15, %rdi
	callq	_spin_unlock_irqrestore
	cmpl	$0, 12(%r12)
	jle	LBB0_20
## %bb.14:
	xorl	%ebx, %ebx
	xorl	%r14d, %r14d
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_15 Depth=1
	incq	%r14
	movslq	12(%r12), %rax
	addq	$12, %rbx
	cmpq	%rax, %r14
	jge	LBB0_20
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	40(%r12), %r12
	leaq	(%r12,%rbx), %r15
	leaq	(%r12,%rbx), %r13
	addq	$4, %r13
	movq	%r13, %rdi
	callq	_atomic_read
	testq	%rax, %rax
	je	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	leaq	(%r12,%rbx), %rdi
	addq	$8, %rdi
	callq	_del_timer_sync
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_atomic_set
LBB0_17:                                ##   in Loop: Header=BB0_15 Depth=1
	movq	_LED_OVER_BOTH_OFF@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r12,%rbx)
	movq	%r15, %rdi
	xorl	%esi, %esi
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	callq	*32(%r12)
	movq	_QIB_HAS_SEND_DMA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	%r15, %rdi
	callq	_qib_teardown_sdma
	jmp	LBB0_19
LBB0_20:
	movq	%r12, %rdi
	callq	*16(%r12)
	cmpl	$1, %eax
	jne	LBB0_22
## %bb.21:
	movq	%r12, %rdi
	movl	$1, %esi
	callq	_qib_init
	movl	%eax, %r15d
	jmp	LBB0_23
LBB0_22:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_23:
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	testl	%r15d, %r15d
	je	LBB0_25
## %bb.24:
	leaq	L_.str.2(%rip), %rsi
	movq	%r12, %rdi
	movl	%r15d, %ecx
	callq	_qib_dev_err
	jmp	LBB0_26
LBB0_25:
	movl	24(%r12), %edi
	leaq	L_.str.3(%rip), %rsi
	callq	_qib_devinfo
	xorl	%r15d, %r15d
	jmp	LBB0_26
	.cfi_endproc
                                        ## -- End function
	.comm	_ENODEV,4,2                     ## @ENODEV
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Reset on unit %u requested\n"

	.comm	_QIB_PRESENT,4,2                ## @QIB_PRESENT
L_.str.1:                               ## @.str.1
	.asciz	"Invalid unit number %u or not initialized or not present\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_LED_OVER_BOTH_OFF,4,2          ## @LED_OVER_BOTH_OFF
	.comm	_QIB_HAS_SEND_DMA,4,2           ## @QIB_HAS_SEND_DMA
	.comm	_EAGAIN,4,2                     ## @EAGAIN
L_.str.2:                               ## @.str.2
	.asciz	"Reinitialize unit %u after reset failed with %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"Reinitialized unit %u after resetting\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_qib_reset_device               ; -- Begin function qib_reset_device
	.p2align	2
_qib_reset_device:                      ; @qib_reset_device
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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, x0
	bl	_qib_lookup
	cbz	x0, LBB0_11
; %bb.1:
	mov	x20, x0
	ldr	w0, [x0, #24]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_qib_devinfo
	ldr	w8, [x20, #64]
	cbz	w8, LBB0_10
; %bb.2:
	ldr	w8, [x20]
Lloh2:
	adrp	x9, _QIB_PRESENT@GOTPAGE
Lloh3:
	ldr	x9, [x9, _QIB_PRESENT@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.3:
	add	x21, x20, #48
	mov	x0, x21
	bl	_spin_lock_irqsave
	ldr	x8, [x20, #56]
	cbz	x8, LBB0_14
; %bb.4:
	ldp	w9, w10, [x20, #4]
                                        ; kill: def $w9 killed $w9 def $x9
	sxtw	x9, w9
	cmp	w9, w10
	b.ge	LBB0_14
; %bb.5:
	add	x8, x8, x9, lsl #3
	sub	w9, w10, w9
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	x8, x8, #8
	subs	w9, w9, #1
	b.eq	LBB0_14
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x10, [x8]
	cbz	x10, LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w10, [x10]
	cbz	w10, LBB0_6
; %bb.9:
	mov	x0, x21
	bl	_spin_unlock_irqrestore
Lloh5:
	adrp	x8, _EBUSY@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_12
LBB0_10:
	ldr	w0, [x20, #24]
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x19
	bl	_qib_devinfo
Lloh9:
	adrp	x8, _ENXIO@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
	b	LBB0_12
LBB0_11:
Lloh11:
	adrp	x8, _ENODEV@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_13:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_14:
	mov	x0, x21
	bl	_spin_unlock_irqrestore
	ldr	w8, [x20, #12]
	cmp	w8, #1
	b.lt	LBB0_21
; %bb.15:
	mov	x23, #0
	mov	x24, #0
Lloh13:
	adrp	x25, _LED_OVER_BOTH_OFF@GOTPAGE
Lloh14:
	ldr	x25, [x25, _LED_OVER_BOTH_OFF@GOTPAGEOFF]
Lloh15:
	adrp	x26, _QIB_HAS_SEND_DMA@GOTPAGE
Lloh16:
	ldr	x26, [x26, _QIB_HAS_SEND_DMA@GOTPAGEOFF]
	b	LBB0_17
LBB0_16:                                ;   in Loop: Header=BB0_17 Depth=1
	add	x24, x24, #1
	ldrsw	x8, [x20, #12]
	add	x23, x23, #12
	cmp	x24, x8
	b.ge	LBB0_21
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	ldr	x27, [x20, #40]
	add	x21, x27, x23
	add	x22, x21, #4
	mov	x0, x22
	bl	_atomic_read
	cbz	x0, LBB0_19
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=1
	add	x0, x21, #8
	bl	_del_timer_sync
	mov	x0, x22
	mov	w1, #0
	bl	_atomic_set
LBB0_19:                                ;   in Loop: Header=BB0_17 Depth=1
	ldr	w8, [x25]
	str	w8, [x27, x23]
	ldr	x8, [x20, #32]
	mov	x0, x21
	mov	w1, #0
	blr	x8
	ldr	w8, [x20]
	ldr	w9, [x26]
	tst	w9, w8
	b.eq	LBB0_16
; %bb.20:                               ;   in Loop: Header=BB0_17 Depth=1
	mov	x0, x21
	bl	_qib_teardown_sdma
	b	LBB0_16
LBB0_21:
	ldr	x8, [x20, #16]
	mov	x0, x20
	blr	x8
	cmp	w0, #1
	b.ne	LBB0_24
; %bb.22:
	mov	x0, x20
	mov	w1, #1
	bl	_qib_init
	mov	x21, x0
	cbz	w21, LBB0_25
LBB0_23:
Lloh17:
	adrp	x1, l_.str.2@PAGE
Lloh18:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	mov	x3, x21
	bl	_qib_dev_err
	b	LBB0_13
LBB0_24:
Lloh19:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	neg	w21, w8
	cbnz	w21, LBB0_23
LBB0_25:
	ldr	w0, [x20, #24]
Lloh22:
	adrp	x1, l_.str.3@PAGE
Lloh23:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x2, x19
	bl	_qib_devinfo
	b	LBB0_13
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_ENODEV,4,2                     ; @ENODEV
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Reset on unit %u requested\n"

	.comm	_QIB_PRESENT,4,2                ; @QIB_PRESENT
l_.str.1:                               ; @.str.1
	.asciz	"Invalid unit number %u or not initialized or not present\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_LED_OVER_BOTH_OFF,4,2          ; @LED_OVER_BOTH_OFF
	.comm	_QIB_HAS_SEND_DMA,4,2           ; @QIB_HAS_SEND_DMA
	.comm	_EAGAIN,4,2                     ; @EAGAIN
l_.str.2:                               ; @.str.2
	.asciz	"Reinitialize unit %u after reset failed with %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"Reinitialized unit %u after resetting\n"

.subsections_via_symbols
