	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hfi1_reset_device              ## -- Begin function hfi1_reset_device
	.p2align	4, 0x90
_hfi1_reset_device:                     ## @hfi1_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	callq	_hfi1_lookup
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movq	%rax, %r12
	leaq	L_.str(%rip), %rsi
	movq	%rax, %rdi
	movl	%r14d, %edx
	callq	_dd_dev_info
	cmpl	$0, 24(%r12)
	je	LBB0_5
## %bb.4:
	movq	_HFI1_PRESENT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_5
## %bb.6:
	movq	_hfi1_mutex@GOTPCREL(%rip), %r15
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	16(%r12), %rbx
	movq	_hfi1_stats@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	movq	%r15, %rdi
	callq	_mutex_unlock
	testq	%rbx, %rbx
	je	LBB0_9
## %bb.7:
	testq	%r13, %r13
	je	LBB0_9
## %bb.8:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_5:
	leaq	L_.str.1(%rip), %rsi
	movq	%r12, %rdi
	movl	%r14d, %edx
	callq	_dd_dev_info
	movq	_ENXIO@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_17:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	cmpl	$0, 4(%r12)
	jle	LBB0_12
## %bb.10:
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r12), %rdi
	addq	%r15, %rdi
	callq	_shutdown_led_override
	incq	%rbx
	movslq	4(%r12), %rax
	addq	$4, %r15
	cmpq	%rax, %rbx
	jl	LBB0_11
LBB0_12:
	movq	_HFI1_HAS_SEND_DMA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_14
## %bb.13:
	movq	%r12, %rdi
	callq	_sdma_exit
LBB0_14:
	movq	%r12, %rdi
	callq	_hfi1_reset_cpu_counters
	movq	%r12, %rdi
	movl	$1, %esi
	callq	_hfi1_init
	testl	%eax, %eax
	je	LBB0_16
## %bb.15:
	movl	%eax, %r15d
	leaq	L_.str.2(%rip), %rsi
	movq	%r12, %rdi
	movl	%r14d, %edx
	movl	%eax, %ecx
	callq	_dd_dev_err
	jmp	LBB0_17
LBB0_16:
	leaq	L_.str.3(%rip), %rsi
	movq	%r12, %rdi
	movl	%r14d, %edx
	callq	_dd_dev_info
	xorl	%r15d, %r15d
	jmp	LBB0_17
	.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	_HFI1_PRESENT,4,2               ## @HFI1_PRESENT
L_.str.1:                               ## @.str.1
	.asciz	"Invalid unit number %u or not initialized or not present\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_hfi1_mutex,4,2                 ## @hfi1_mutex
	.comm	_hfi1_stats,8,3                 ## @hfi1_stats
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_HFI1_HAS_SEND_DMA,4,2          ## @HFI1_HAS_SEND_DMA
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	_hfi1_reset_device              ; -- Begin function hfi1_reset_device
	.p2align	2
_hfi1_reset_device:                     ; @hfi1_reset_device
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
	bl	_hfi1_lookup
	cbz	x0, LBB0_7
; %bb.1:
	mov	x20, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_dd_dev_info
	ldr	w8, [x20, #24]
	cbz	w8, LBB0_6
; %bb.2:
	ldr	w8, [x20]
Lloh2:
	adrp	x9, _HFI1_PRESENT@GOTPAGE
Lloh3:
	ldr	x9, [x9, _HFI1_PRESENT@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.3:
Lloh5:
	adrp	x21, _hfi1_mutex@GOTPAGE
Lloh6:
	ldr	x21, [x21, _hfi1_mutex@GOTPAGEOFF]
	mov	x0, x21
	bl	_mutex_lock
	ldr	x23, [x20, #16]
Lloh7:
	adrp	x8, _hfi1_stats@GOTPAGE
Lloh8:
	ldr	x8, [x8, _hfi1_stats@GOTPAGEOFF]
Lloh9:
	ldr	x22, [x8]
	mov	x0, x21
	bl	_mutex_unlock
	cbz	x23, LBB0_10
; %bb.4:
	cbz	x22, LBB0_10
; %bb.5:
Lloh10:
	adrp	x8, _EBUSY@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_8
LBB0_6:
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	bl	_dd_dev_info
Lloh14:
	adrp	x8, _ENXIO@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
	b	LBB0_8
LBB0_7:
Lloh16:
	adrp	x8, _ENODEV@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_9:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_10:
	ldr	w8, [x20, #4]
	cmp	w8, #1
	b.lt	LBB0_13
; %bb.11:
	mov	x21, #0
	mov	x22, #0
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #8]
	add	x0, x8, x21
	bl	_shutdown_led_override
	add	x22, x22, #1
	ldrsw	x8, [x20, #4]
	add	x21, x21, #4
	cmp	x22, x8
	b.lt	LBB0_12
LBB0_13:
	ldr	w8, [x20]
Lloh18:
	adrp	x9, _HFI1_HAS_SEND_DMA@GOTPAGE
Lloh19:
	ldr	x9, [x9, _HFI1_HAS_SEND_DMA@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_15
; %bb.14:
	mov	x0, x20
	bl	_sdma_exit
LBB0_15:
	mov	x0, x20
	bl	_hfi1_reset_cpu_counters
	mov	x0, x20
	mov	w1, #1
	bl	_hfi1_init
	mov	x21, x0
	cbz	w0, LBB0_17
; %bb.16:
Lloh21:
	adrp	x1, l_.str.2@PAGE
Lloh22:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	mov	x3, x21
	bl	_dd_dev_err
	b	LBB0_9
LBB0_17:
Lloh23:
	adrp	x1, l_.str.3@PAGE
Lloh24:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	bl	_dd_dev_info
	b	LBB0_9
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.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	_HFI1_PRESENT,4,2               ; @HFI1_PRESENT
l_.str.1:                               ; @.str.1
	.asciz	"Invalid unit number %u or not initialized or not present\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_hfi1_mutex,4,2                 ; @hfi1_mutex
	.comm	_hfi1_stats,8,3                 ; @hfi1_stats
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_HFI1_HAS_SEND_DMA,4,2          ; @HFI1_HAS_SEND_DMA
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
