	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlx4_get_slave_from_roce_gid   ## -- Begin function mlx4_get_slave_from_roce_gid
	.p2align	4, 0x90
_mlx4_get_slave_from_roce_gid:          ## @mlx4_get_slave_from_roce_gid
	.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	%rcx, %r15
	movq	%rdx, %r13
	movl	%esi, %r12d
	movq	%rdi, %rbx
	callq	_mlx4_priv
	movq	%rax, %r14
	movq	_MLX4_ROCE_MAX_GIDS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_MLX4_ROCE_PF_GIDS@GOTPCREL(%rip), %rcx
	subl	(%rcx), %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movq	%rbx, %rdi
	callq	_mlx4_is_mfunc
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	movl	%r12d, -56(%rbp)                ## 4-byte Spill
	movl	%r12d, %esi
	callq	_mlx4_phys_to_slaves_pport
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	(%rbx), %rcx
	movl	(%rcx), %esi
	incl	%esi
	movl	%eax, %edi
	callq	_bitmap_weight
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	_MLX4_ROCE_MAX_GIDS@GOTPCREL(%rip), %rbx
	cmpl	$0, (%rbx)
	jle	LBB0_1
## %bb.3:
	decl	-52(%rbp)                       ## 4-byte Folded Spill
	movslq	-56(%rbp), %r12                 ## 4-byte Folded Reload
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rax
	movq	(%rax,%r12,8), %rax
	movl	(%rax,%r15,4), %edi
	movq	_MLX4_ROCE_GID_ENTRY_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rsi
	callq	_memcmp
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	incq	%r15
	movslq	(%rbx), %rax
	cmpq	%rax, %r15
	jl	LBB0_4
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_18:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	_MLX4_ROCE_PF_GIDS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	cmpl	%r15d, %edi
	movl	-56(%rbp), %r13d                ## 4-byte Reload
	jg	LBB0_19
## %bb.7:
	movl	-60(%rbp), %eax                 ## 4-byte Reload
	xorl	%edx, %edx
	divl	-52(%rbp)                       ## 4-byte Folded Reload
	movl	%eax, %esi
	leal	1(%rsi), %ebx
	movl	%ebx, %eax
	imull	%edx, %eax
	addl	%edi, %eax
	cmpl	%r15d, %eax
	jbe	LBB0_9
## %bb.8:
	subl	%edi, %r15d
	movl	%r15d, %eax
	xorl	%edx, %edx
	divl	%ebx
	movl	%eax, %r12d
	incl	%r12d
	jne	LBB0_11
LBB0_19:
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	$0, (%rax)
	jmp	LBB0_17
LBB0_9:
	movl	%edx, %ecx
	subl	%eax, %r15d
	movl	%r15d, %eax
	xorl	%edx, %edx
	divl	%esi
	movl	%eax, %r12d
	addl	%ecx, %r12d
	incl	%r12d
	je	LBB0_19
LBB0_11:
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_mlx4_get_active_ports
	movl	%eax, %r15d
	movl	8(%rbx), %esi
	movl	%eax, %edi
	callq	_find_first_bit
	movl	%eax, %r14d
	movl	8(%rbx), %esi
	movl	%r15d, %edi
	callq	_bitmap_weight
                                        ## kill: def $eax killed $eax def $rax
	leal	(%r14,%rax), %ecx
	incl	%ecx
	cmpl	$2, %ecx
	jb	LBB0_16
## %bb.12:
	addl	%eax, %r14d
	decl	%r13d
	xorl	%ebx, %ebx
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_13 Depth=1
	incl	%ebx
	cmpl	%ebx, %r14d
	je	LBB0_16
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	cmpl	%ebx, %r13d
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	movl	-48(%rbp), %edi
	movl	8(%r15), %esi
	callq	_bitmap_zero
	movl	-48(%rbp), %esi
	movl	%ebx, %edi
	callq	_set_bit
	movq	%r15, %rdi
	leaq	-48(%rbp), %rsi
	callq	_mlx4_phys_to_slaves_pport_actv
	movq	(%r15), %rcx
	movl	(%rcx), %esi
	incl	%esi
	movl	%eax, %edi
	callq	_bitmap_weight
	addl	%eax, %r12d
	jmp	LBB0_15
LBB0_16:
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	%r12d, (%rax)
LBB0_17:
	xorl	%eax, %eax
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_MLX4_ROCE_MAX_GIDS,4,2         ## @MLX4_ROCE_MAX_GIDS
	.comm	_MLX4_ROCE_PF_GIDS,4,2          ## @MLX4_ROCE_PF_GIDS
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MLX4_ROCE_GID_ENTRY_SIZE,4,2   ## @MLX4_ROCE_GID_ENTRY_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlx4_get_slave_from_roce_gid   ; -- Begin function mlx4_get_slave_from_roce_gid
	.p2align	2
_mlx4_get_slave_from_roce_gid:          ; @mlx4_get_slave_from_roce_gid
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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, x3
	mov	x22, x2
	mov	x21, x1
	mov	x20, x0
	bl	_mlx4_priv
	mov	x23, x0
Lloh0:
	adrp	x25, _MLX4_ROCE_MAX_GIDS@GOTPAGE
Lloh1:
	ldr	x25, [x25, _MLX4_ROCE_MAX_GIDS@GOTPAGEOFF]
	ldr	w27, [x25]
Lloh2:
	adrp	x24, _MLX4_ROCE_PF_GIDS@GOTPAGE
Lloh3:
	ldr	x24, [x24, _MLX4_ROCE_PF_GIDS@GOTPAGEOFF]
	ldr	w28, [x24]
	mov	x0, x20
	bl	_mlx4_is_mfunc
	cbz	w0, LBB0_5
; %bb.1:
	str	x19, [sp, #16]                  ; 8-byte Folded Spill
	mov	x0, x20
	mov	x1, x21
	bl	_mlx4_phys_to_slaves_pport
	ldr	x8, [x20]
	ldr	w8, [x8]
	add	w1, w8, #1
	bl	_bitmap_weight
	ldr	w8, [x25]
	cmp	w8, #1
	b.lt	LBB0_5
; %bb.2:
	mov	x26, #0
	sub	w8, w27, w28
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	sub	w28, w0, #1
	sxtw	x19, w21
Lloh4:
	adrp	x27, _MLX4_ROCE_GID_ENTRY_SIZE@GOTPAGE
Lloh5:
	ldr	x27, [x27, _MLX4_ROCE_GID_ENTRY_SIZE@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x23]
	ldr	x8, [x8, x19, lsl #3]
	ldr	w0, [x8, x26, lsl #2]
	ldr	w2, [x27]
	mov	x1, x22
	bl	_memcmp
	cbz	w0, LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x26, x26, #1
	ldrsw	x8, [x25]
	cmp	x26, x8
	b.lt	LBB0_3
LBB0_5:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_6:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_7:
	ldr	w8, [x24]
	cmp	w8, w26
	b.gt	LBB0_9
; %bb.8:
	ldr	w10, [sp, #12]                  ; 4-byte Folded Reload
	udiv	w9, w10, w28
	msub	w10, w9, w28, w10
	add	w11, w9, #1
	madd	w12, w11, w10, w8
	sub	w13, w26, w12
	udiv	w9, w13, w9
	add	w9, w9, w10
	sub	w8, w26, w8
	udiv	w8, w8, w11
	cmp	w12, w26
	csel	w8, w9, w8, ls
	adds	w22, w8, #1
	b.lo	LBB0_10
LBB0_9:
	mov	w0, #0
	ldr	x8, [sp, #16]                   ; 8-byte Folded Reload
	str	wzr, [x8]
	b	LBB0_6
LBB0_10:
	mov	x0, x20
	mov	x1, x22
	bl	_mlx4_get_active_ports
	mov	x23, x0
	ldr	w1, [x20, #8]
	bl	_find_first_bit
	mov	x24, x0
	ldr	w1, [x20, #8]
	mov	x0, x23
	bl	_bitmap_weight
	add	w24, w24, w0
	add	w8, w24, #1
	cmp	w8, #2
	ldr	x19, [sp, #16]                  ; 8-byte Folded Reload
	b.lo	LBB0_15
; %bb.11:
	mov	w23, #0
	sub	w21, w21, #1
	b	LBB0_13
LBB0_12:                                ;   in Loop: Header=BB0_13 Depth=1
	add	w23, w23, #1
	cmp	w24, w23
	b.eq	LBB0_15
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	cmp	w21, w23
	b.eq	LBB0_12
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	w0, [sp, #24]
	ldr	w1, [x20, #8]
	bl	_bitmap_zero
	ldr	w1, [sp, #24]
	mov	x0, x23
	bl	_set_bit
	add	x1, sp, #24
	mov	x0, x20
	bl	_mlx4_phys_to_slaves_pport_actv
	ldr	x8, [x20]
	ldr	w8, [x8]
	add	w1, w8, #1
	bl	_bitmap_weight
	add	w22, w0, w22
	b	LBB0_12
LBB0_15:
	mov	w0, #0
	str	w22, [x19]
	b	LBB0_6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_MLX4_ROCE_MAX_GIDS,4,2         ; @MLX4_ROCE_MAX_GIDS
	.comm	_MLX4_ROCE_PF_GIDS,4,2          ; @MLX4_ROCE_PF_GIDS
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MLX4_ROCE_GID_ENTRY_SIZE,4,2   ; @MLX4_ROCE_GID_ENTRY_SIZE
.subsections_via_symbols
