	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlx5_create_ah                 ## -- Begin function mlx5_create_ah
	.p2align	4, 0x90
_mlx5_create_ah:                        ## @mlx5_create_ah
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r13
	movq	%rdi, %r15
	movl	(%rdi), %edi
	callq	_to_mctx
	movl	(%r13), %esi
	testl	%esi, %esi
	jle	LBB0_23
## %bb.1:
	movq	%rax, %r12
	cmpl	(%rax), %esi
	jg	LBB0_23
## %bb.2:
	movq	8(%r12), %rax
	leal	-1(%rsi), %ecx
	movq	(%rax,%rcx,8), %rbx
	testq	%rbx, %rbx
	je	LBB0_3
LBB0_5:
	movq	_IBV_LINK_LAYER_ETHERNET@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movq	%rbx, %rax
	xorq	%r14, %rax
	xorl	%edi, %edi
	orq	40(%r13), %rax
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_errno@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	jmp	LBB0_23
LBB0_3:
	movl	(%r15), %edi
	leaq	-80(%rbp), %rdx
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_ibv_query_port
	testq	%rax, %rax
	jne	LBB0_23
## %bb.4:
	movq	-80(%rbp), %rbx
	jmp	LBB0_5
LBB0_7:
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movl	$1, %edi
	movl	$48, %esi
	callq	_calloc
	testq	%rax, %rax
	je	LBB0_23
## %bb.8:
	movq	%rax, %r14
	cmpq	-64(%rbp), %rbx                 ## 8-byte Folded Reload
	jne	LBB0_12
## %bb.9:
	movl	(%r15), %edi
	movl	(%r13), %esi
	movl	20(%r13), %edx
	leaq	-72(%rbp), %rcx
	callq	_ibv_query_gid_type
	testq	%rax, %rax
	jne	LBB0_22
## %bb.10:
	movq	-72(%rbp), %rax
	movq	_IBV_GID_TYPE_ROCE_V2@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	cmpq	(%rcx), %rax
	jne	LBB0_14
## %bb.11:
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	xorl	%eax, %eax
	callq	_rand
	movq	_RROCE_UDP_SPORT_MAX@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_RROCE_UDP_SPORT_MIN@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	subl	%esi, %ecx
	incl	%ecx
	cltd
	idivl	%ecx
	movl	%edx, %edi
	addl	%esi, %edi
	jmp	LBB0_13
LBB0_12:
	movl	4(%r13), %eax
	andl	$127, %eax
	movl	%eax, 8(%r14)
	movl	8(%r13), %edi
	movl	$1073741824, -44(%rbp)          ## 4-byte Folded Spill
                                        ## imm = 0x40000000
LBB0_13:
	callq	_htobe16
	movq	%rax, 40(%r14)
	movl	-44(%rbp), %edx                 ## 4-byte Reload
LBB0_14:
	movl	12(%r13), %eax
	shll	$4, %eax
	orl	16(%r13), %eax
	movl	%eax, 12(%r14)
	cmpq	$0, 40(%r13)
	je	LBB0_16
## %bb.15:
	movl	36(%r13), %eax
	movl	%eax, 36(%r14)
	movl	32(%r13), %eax
	movl	%eax, 32(%r14)
	movl	20(%r13), %eax
	movzbl	%al, %eax
	shll	$20, %eax
	orl	%edx, %eax
	movl	$1048575, %edi                  ## imm = 0xFFFFF
	andl	24(%r13), %edi
	orl	%eax, %edi
	callq	_htobe32
	movq	%rax, 24(%r14)
	movl	20(%r14), %edi
	movl	28(%r13), %esi
	movl	$16, %edx
	callq	_memcpy
LBB0_16:
	cmpq	-64(%rbp), %rbx                 ## 8-byte Folded Reload
	jne	LBB0_21
## %bb.17:
	movq	_MLX5_USER_CMDS_SUPP_UHW_CREATE_AH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 16(%r12)
	je	LBB0_20
## %bb.18:
	movq	$0, -56(%rbp)
	leaq	4(%r14), %rsi
	leaq	-52(%rbp), %rcx
	movq	%r15, %rdi
	movq	%r13, %rdx
	movl	$8, %r8d
	callq	_ibv_cmd_create_ah
	testq	%rax, %rax
	jne	LBB0_22
## %bb.19:
	movl	$1, (%r14)
	movl	16(%r14), %edi
	movl	-56(%rbp), %esi
	movq	_ETHERNET_LL_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_memcpy
	addq	$4, %r14
	jmp	LBB0_24
LBB0_20:
	movl	(%r15), %edi
	movl	16(%r14), %edx
	leaq	-56(%rbp), %rcx
	movq	%r13, %rsi
	callq	_ibv_resolve_eth_l2_from_gid
	testq	%rax, %rax
	je	LBB0_21
LBB0_22:
	movq	%r14, %rdi
	callq	_free
LBB0_23:
	xorl	%r14d, %r14d
LBB0_24:
	movq	%r14, %rax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_21:
	addq	$4, %r14
	jmp	LBB0_24
	.cfi_endproc
                                        ## -- End function
	.comm	_IBV_LINK_LAYER_ETHERNET,8,3    ## @IBV_LINK_LAYER_ETHERNET
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_errno,4,2                      ## @errno
	.comm	_IBV_GID_TYPE_ROCE_V2,8,3       ## @IBV_GID_TYPE_ROCE_V2
	.comm	_RROCE_UDP_SPORT_MAX,4,2        ## @RROCE_UDP_SPORT_MAX
	.comm	_RROCE_UDP_SPORT_MIN,4,2        ## @RROCE_UDP_SPORT_MIN
	.comm	_MLX5_USER_CMDS_SUPP_UHW_CREATE_AH,4,2 ## @MLX5_USER_CMDS_SUPP_UHW_CREATE_AH
	.comm	_ETHERNET_LL_SIZE,4,2           ## @ETHERNET_LL_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlx5_create_ah                 ; -- Begin function mlx5_create_ah
	.p2align	2
_mlx5_create_ah:                        ; @mlx5_create_ah
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x19, x1
	mov	x20, x0
	ldr	w0, [x0]
	bl	_to_mctx
	ldr	w1, [x19]
	subs	w8, w1, #1
	b.lt	LBB0_2
; %bb.1:
	mov	x22, x0
	ldr	w9, [x0]
	cmp	w1, w9
	b.le	LBB0_4
LBB0_2:
	mov	x0, #0
LBB0_3:
	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
	add	sp, sp, #112
	ret
LBB0_4:
	ldr	x9, [x22, #8]
	ldr	x23, [x9, w8, uxtw #3]
	cbz	x23, LBB0_7
LBB0_5:
Lloh0:
	adrp	x8, _IBV_LINK_LAYER_ETHERNET@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IBV_LINK_LAYER_ETHERNET@GOTPAGEOFF]
Lloh2:
	ldr	x24, [x8]
	ldr	x8, [x19, #40]
	cmp	x8, #0
	ccmp	x23, x24, #0, eq
	cset	w0, eq
	bl	_unlikely
	cbz	x0, LBB0_9
; %bb.6:
	mov	x0, #0
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _errno@GOTPAGE
Lloh7:
	ldr	x9, [x9, _errno@GOTPAGEOFF]
Lloh8:
	str	w8, [x9]
	b	LBB0_3
LBB0_7:
	ldr	w0, [x20]
	add	x2, sp, #24
	bl	_ibv_query_port
	cbnz	x0, LBB0_2
; %bb.8:
	ldr	x23, [sp, #24]
	b	LBB0_5
LBB0_9:
	mov	w0, #1
	mov	w1, #48
	bl	_calloc
	cbz	x0, LBB0_3
; %bb.10:
	mov	x21, x0
	cmp	x23, x24
	b.ne	LBB0_14
; %bb.11:
	ldr	w0, [x20]
	ldr	w1, [x19]
	ldr	w2, [x19, #20]
	add	x3, sp, #16
	bl	_ibv_query_gid_type
	cbnz	x0, LBB0_23
; %bb.12:
	ldr	x8, [sp, #16]
Lloh9:
	adrp	x9, _IBV_GID_TYPE_ROCE_V2@GOTPAGE
Lloh10:
	ldr	x9, [x9, _IBV_GID_TYPE_ROCE_V2@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_25
; %bb.13:
	bl	_rand
	mov	w25, #0
Lloh12:
	adrp	x8, _RROCE_UDP_SPORT_MAX@GOTPAGE
Lloh13:
	ldr	x8, [x8, _RROCE_UDP_SPORT_MAX@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
Lloh15:
	adrp	x9, _RROCE_UDP_SPORT_MIN@GOTPAGE
Lloh16:
	ldr	x9, [x9, _RROCE_UDP_SPORT_MIN@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	sub	w8, w8, w9
	add	w8, w8, #1
	sdiv	w10, w0, w8
	msub	w8, w10, w8, w0
	add	w0, w8, w9
	b	LBB0_15
LBB0_14:
	ldp	w8, w0, [x19, #4]
	and	w8, w8, #0x7f
	str	w8, [x21, #8]
	mov	w25, #1073741824
LBB0_15:
	bl	_htobe16
	str	x0, [x21, #40]
LBB0_16:
	ldp	w8, w9, [x19, #12]
	orr	w8, w9, w8, lsl #4
	str	w8, [x21, #12]
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_18
; %bb.17:
	ldr	d0, [x19, #32]
	str	d0, [x21, #32]
	ldp	w8, w9, [x19, #20]
	ubfiz	w8, w8, #20, #8
	orr	w8, w8, w25
	and	w9, w9, #0xfffff
	orr	w0, w8, w9
	bl	_htobe32
	str	x0, [x21, #24]
	ldr	w0, [x21, #20]
	ldr	w1, [x19, #28]
	mov	w2, #16
	bl	_memcpy
LBB0_18:
	cmp	x23, x24
	b.ne	LBB0_24
; %bb.19:
	ldr	w8, [x22, #16]
Lloh18:
	adrp	x9, _MLX5_USER_CMDS_SUPP_UHW_CREATE_AH@GOTPAGE
Lloh19:
	ldr	x9, [x9, _MLX5_USER_CMDS_SUPP_UHW_CREATE_AH@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_22
; %bb.20:
	str	xzr, [sp, #8]
	add	x1, x21, #4
	add	x8, sp, #8
	orr	x3, x8, #0x4
	mov	x0, x20
	mov	x2, x19
	mov	w4, #8
	bl	_ibv_cmd_create_ah
	cbnz	x0, LBB0_23
; %bb.21:
	mov	w8, #1
	str	w8, [x21]
	ldr	w0, [x21, #16]
	ldr	w1, [sp, #8]
Lloh21:
	adrp	x8, _ETHERNET_LL_SIZE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ETHERNET_LL_SIZE@GOTPAGEOFF]
Lloh23:
	ldr	w2, [x8]
	bl	_memcpy
	add	x0, x21, #4
	b	LBB0_3
LBB0_22:
	ldr	w0, [x20]
	ldr	w2, [x21, #16]
	add	x3, sp, #8
	mov	x1, x19
	bl	_ibv_resolve_eth_l2_from_gid
	cbz	x0, LBB0_24
LBB0_23:
	mov	x0, x21
	bl	_free
	b	LBB0_2
LBB0_24:
	add	x0, x21, #4
	b	LBB0_3
LBB0_25:
	mov	w25, #0
	b	LBB0_16
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotStr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_IBV_LINK_LAYER_ETHERNET,8,3    ; @IBV_LINK_LAYER_ETHERNET
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_errno,4,2                      ; @errno
	.comm	_IBV_GID_TYPE_ROCE_V2,8,3       ; @IBV_GID_TYPE_ROCE_V2
	.comm	_RROCE_UDP_SPORT_MAX,4,2        ; @RROCE_UDP_SPORT_MAX
	.comm	_RROCE_UDP_SPORT_MIN,4,2        ; @RROCE_UDP_SPORT_MIN
	.comm	_MLX5_USER_CMDS_SUPP_UHW_CREATE_AH,4,2 ; @MLX5_USER_CMDS_SUPP_UHW_CREATE_AH
	.comm	_ETHERNET_LL_SIZE,4,2           ; @ETHERNET_LL_SIZE
.subsections_via_symbols
