	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function shader_calculate_clip_or_cull_distance_mask
_shader_calculate_clip_or_cull_distance_mask: ## @shader_calculate_clip_or_cull_distance_mask
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	movl	(%rdi), %ecx
	movq	_MAX_CLIP_DISTANCES@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovnsl	%eax, %edx
	sarl	$2, %edx
	cmpl	%edx, %ecx
	jge	LBB0_1
## %bb.2:
	movq	_WINED3DSP_WRITEMASK_ALL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	4(%rdi), %eax
	shll	$2, %ecx
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	movl	%eax, (%rsi)
	movq	_WINED3D_OK@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movl	$0, (%rsi)
	movl	(%rdi), %esi
	leaq	L_.str(%rip), %rdi
	callq	_WARN
	movq	_WINED3DERR_INVALIDCALL@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %eax
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_CLIP_DISTANCES,4,2         ## @MAX_CLIP_DISTANCES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid clip/cull distance index %u.\n"

	.comm	_WINED3DERR_INVALIDCALL,4,2     ## @WINED3DERR_INVALIDCALL
	.comm	_WINED3DSP_WRITEMASK_ALL,4,2    ## @WINED3DSP_WRITEMASK_ALL
	.comm	_WINED3D_OK,4,2                 ## @WINED3D_OK
	.no_dead_strip	_shader_calculate_clip_or_cull_distance_mask
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function shader_calculate_clip_or_cull_distance_mask
_shader_calculate_clip_or_cull_distance_mask: ; @shader_calculate_clip_or_cull_distance_mask
	.cfi_startproc
; %bb.0:
	stp	x29, x30, [sp, #-16]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 16
	mov	x29, sp
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
Lloh0:
	adrp	x9, _MAX_CLIP_DISTANCES@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MAX_CLIP_DISTANCES@GOTPAGEOFF]
	ldr	w8, [x0]
Lloh2:
	ldr	w9, [x9]
	add	w10, w9, #3
	cmp	w9, #0
	csel	w9, w10, w9, lt
	cmp	w8, w9, asr #2
	b.ge	LBB0_2
; %bb.1:
	ldr	w9, [x0, #4]
Lloh3:
	adrp	x10, _WINED3DSP_WRITEMASK_ALL@GOTPAGE
Lloh4:
	ldr	x10, [x10, _WINED3DSP_WRITEMASK_ALL@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	and	w9, w10, w9
	lsl	w8, w8, #2
	lsl	w8, w9, w8
	str	w8, [x1]
Lloh6:
	adrp	x8, _WINED3D_OK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _WINED3D_OK@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:
	str	wzr, [x1]
	ldr	w1, [x0]
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	bl	_WARN
Lloh10:
	adrp	x8, _WINED3DERR_INVALIDCALL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _WINED3DERR_INVALIDCALL@GOTPAGEOFF]
LBB0_3:
	ldr	w0, [x8]
	ldp	x29, x30, [sp], #16             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_CLIP_DISTANCES,4,2         ; @MAX_CLIP_DISTANCES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid clip/cull distance index %u.\n"

	.comm	_WINED3DERR_INVALIDCALL,4,2     ; @WINED3DERR_INVALIDCALL
	.comm	_WINED3DSP_WRITEMASK_ALL,4,2    ; @WINED3DSP_WRITEMASK_ALL
	.comm	_WINED3D_OK,4,2                 ; @WINED3D_OK
	.no_dead_strip	_shader_calculate_clip_or_cull_distance_mask
.subsections_via_symbols
