	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mthca_cmd_wait
_mthca_cmd_wait:                        ## @mthca_cmd_wait
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r9d, -56(%rbp)                 ## 4-byte Spill
	movl	%r8d, -64(%rbp)                 ## 4-byte Spill
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movq	%rdx, %r12
	movl	%esi, -60(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r13
	addq	$8, %rdi
	movq	%rdi, -96(%rbp)                 ## 8-byte Spill
	callq	_down
	leaq	12(%r13), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock
	xorl	%edi, %edi
	callq	_BUG_ON
	movq	(%r13), %r15
	movq	16(%r13), %r14
	shlq	$5, %r15
	movl	24(%r13), %eax
	leaq	(%r14,%r15), %rcx
	addq	$28, %rcx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	movl	28(%r14,%r15), %ecx
	leal	1(%rax,%rcx), %eax
	movl	%eax, 28(%r14,%r15)
	movq	(%r14,%r15), %rax
	movq	%rax, (%r13)
	movq	%rbx, -88(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	movq	%r12, %rbx
	callq	_spin_unlock
	leaq	(%r14,%r15), %rdi
	addq	$24, %rdi
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	callq	_init_completion
	xorl	%edx, %edx
	testq	%r12, %r12
	je	LBB0_2
## %bb.1:
	movl	(%rbx), %edx
LBB0_2:
	leaq	(%r14,%r15), %r12
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %eax
	movq	%r13, %rdi
	movl	-60(%rbp), %esi                 ## 4-byte Reload
	movl	-64(%rbp), %ecx                 ## 4-byte Reload
	movl	-56(%rbp), %r8d                 ## 4-byte Reload
	movl	16(%rbp), %r9d
	pushq	$1
	pushq	%rax
	callq	_mthca_cmd_post
	addq	$16, %rsp
	testl	%eax, %eax
	jne	LBB0_15
## %bb.3:
	movq	24(%rbp), %rsi
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_wait_for_completion_timeout
	testl	%eax, %eax
	je	LBB0_4
## %bb.5:
	movl	8(%r14,%r15), %eax
	testl	%eax, %eax
	jne	LBB0_15
## %bb.6:
	movq	16(%r14,%r15), %rcx
	testq	%rcx, %rcx
	je	LBB0_7
## %bb.8:
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	leaq	(%r14,%r15), %rbx
	addq	$16, %rbx
	leaq	L_.str(%rip), %rsi
	movq	%r13, %rdi
	movl	16(%rbp), %edx
	callq	_mthca_dbg
	movq	(%rbx), %rdi
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	callq	_mthca_status_to_errno
	jmp	LBB0_9
LBB0_4:
	movq	_EBUSY@GOTPCREL(%rip), %rcx
LBB0_14:
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_15
LBB0_7:
	xorl	%eax, %eax
LBB0_9:
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	testq	%rbx, %rbx
	je	LBB0_12
## %bb.10:
	testl	%ecx, %ecx
	je	LBB0_12
## %bb.11:
	movl	12(%r14,%r15), %ecx
	movl	%ecx, (%rbx)
	jmp	LBB0_15
LBB0_12:
	testl	%ecx, %ecx
	je	LBB0_15
## %bb.13:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	jmp	LBB0_14
LBB0_15:
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movl	%eax, %r14d
	callq	_spin_lock
	movq	(%r13), %rax
	movq	%rax, (%r12)
	subq	16(%r13), %r12
	sarq	$5, %r12
	movq	%r12, (%r13)
	movq	%rbx, %rdi
	callq	_spin_unlock
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	callq	_up
	movl	%r14d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EBUSY,4,2                      ## @EBUSY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Command %02x completed with status %02x\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_mthca_cmd_wait
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mthca_cmd_wait
_mthca_cmd_wait:                        ; @mthca_cmd_wait
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x24, x6
	mov	x26, x5
	mov	x27, x4
	str	w3, [sp, #12]                   ; 4-byte Folded Spill
	mov	x22, x2
	mov	x28, x1
	mov	x20, x0
	add	x0, x0, #8
	stp	x7, x0, [sp, #32]               ; 16-byte Folded Spill
	bl	_down
	add	x21, x20, #12
	mov	x0, x21
	bl	_spin_lock
	mov	w0, #0
	bl	_BUG_ON
	ldr	x8, [x20, #16]
	ldr	x9, [x20]
	stp	x9, x8, [sp, #16]               ; 16-byte Folded Spill
	add	x19, x8, x9, lsl #5
	ldr	w8, [x20, #24]
	mov	x25, x19
	ldr	w9, [x25, #28]!
	add	w8, w8, w9
	add	w8, w8, #1
	str	w8, [x25]
	mov	x23, x19
	ldr	x8, [x23], #24
	str	x8, [x20]
	mov	x0, x21
	bl	_spin_unlock
	mov	x0, x23
	bl	_init_completion
	cbz	x22, LBB0_2
; %bb.1:
	ldr	w2, [x22]
	b	LBB0_3
LBB0_2:
	mov	w2, #0
LBB0_3:
	ldr	w6, [x25]
	mov	x0, x20
	mov	x1, x28
	mov	x3, x27
	mov	x4, x26
	mov	x5, x24
	mov	w7, #1
	bl	_mthca_cmd_post
	mov	x26, x0
	cbnz	w0, LBB0_15
; %bb.4:
	mov	x0, x23
	ldr	x1, [sp, #32]                   ; 8-byte Folded Reload
	bl	_wait_for_completion_timeout
	cbz	w0, LBB0_8
; %bb.5:
	ldp	x9, x8, [sp, #16]               ; 16-byte Folded Reload
	add	x23, x8, x9, lsl #5
	ldr	w26, [x23, #8]
	cbnz	w26, LBB0_15
; %bb.6:
	ldr	x3, [x23, #16]!
	cbz	x3, LBB0_10
; %bb.7:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	mov	x2, x24
	bl	_mthca_dbg
	ldr	x0, [x23]
	bl	_mthca_status_to_errno
	mov	x26, x0
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	cbnz	x22, LBB0_11
	b	LBB0_13
LBB0_8:
Lloh2:
	adrp	x8, _EBUSY@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w26, w8
	b	LBB0_15
LBB0_10:
	mov	w26, #0
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	cbz	x22, LBB0_13
LBB0_11:
	cbz	w8, LBB0_13
; %bb.12:
	ldp	x9, x8, [sp, #16]               ; 16-byte Folded Reload
	add	x8, x8, x9, lsl #5
	ldr	w8, [x8, #12]
	str	w8, [x22]
	b	LBB0_15
LBB0_13:
	cbz	w8, LBB0_15
; %bb.14:
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_9
LBB0_15:
	mov	x0, x21
	bl	_spin_lock
	ldr	x8, [x20]
	str	x8, [x19]
	ldr	x8, [x20, #16]
	sub	x8, x19, x8
	asr	x8, x8, #5
	str	x8, [x20]
	mov	x0, x21
	bl	_spin_unlock
	ldr	x0, [sp, #40]                   ; 8-byte Folded Reload
	bl	_up
	mov	x0, x26
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_EBUSY,4,2                      ; @EBUSY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Command %02x completed with status %02x\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_mthca_cmd_wait
.subsections_via_symbols
