	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function convert_to_wined3d_declaration
_convert_to_wined3d_declaration:        ## @convert_to_wined3d_declaration
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r13
	leaq	L_.str(%rip), %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	movq	%r14, %rcx
	callq	_TRACE
	leaq	120(%r13), %rax
	movl	$4, %ebx
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$255, -96(%rax)
	je	LBB0_7
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$255, -64(%rax)
	je	LBB0_8
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$255, -32(%rax)
	je	LBB0_11
## %bb.4:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$255, (%rax)
	je	LBB0_9
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	subq	$-128, %rax
	addl	$4, %ebx
	cmpl	$132, %ebx
	jne	LBB0_1
## %bb.6:
	movl	$129, %ebx
	jmp	LBB0_12
LBB0_7:
	addl	$-3, %ebx
	cmpl	$128, %ebx
	jne	LBB0_12
	jmp	LBB0_20
LBB0_8:
	addl	$-2, %ebx
LBB0_9:
	cmpl	$128, %ebx
	jne	LBB0_12
	jmp	LBB0_20
LBB0_11:
	decl	%ebx
	cmpl	$128, %ebx
	je	LBB0_20
LBB0_12:
	leal	-1(%rbx), %r12d
	movl	%r12d, %eax
	shll	$4, %eax
	leal	(%rax,%rax,2), %edi
	callq	_heap_alloc
	movq	%rax, (%r15)
	testq	%rax, %rax
	je	LBB0_18
## %bb.13:
	movl	%r12d, -44(%rbp)                ## 4-byte Spill
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	cmpl	$2, %ebx
	jb	LBB0_17
## %bb.14:
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movq	_d3d_dtype_lookup@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdi
	shlq	$4, %rax
	leaq	(%rax,%rax,2), %r14
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r13), %rbx
	callq	_ARRAY_SIZE
	cmpq	%rax, %rbx
	jae	LBB0_19
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	_d3d_dtype_lookup@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	(%r13), %rax
	movl	(%rdi,%rax,4), %eax
	movq	(%r15), %rcx
	movl	%eax, 40(%rcx,%r12)
	movl	24(%r13), %eax
	movl	%eax, 36(%rcx,%r12)
	movl	20(%r13), %eax
	movl	%eax, 32(%rcx,%r12)
	movq	_WINED3D_OUTPUT_SLOT_SEMANTIC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 28(%rcx,%r12)
	movq	_WINED3D_INPUT_PER_VERTEX_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%rcx,%r12)
	movq	$0, 16(%rcx,%r12)
	movl	16(%r13), %eax
	movl	%eax, 8(%rcx,%r12)
	movl	12(%r13), %eax
	movl	%eax, 4(%rcx,%r12)
	movl	8(%r13), %eax
	movl	%eax, (%rcx,%r12)
	addq	$48, %r12
	addq	$32, %r13
	cmpq	%r12, %r14
	jne	LBB0_15
LBB0_17:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, (%rax)
	movq	_D3D_OK@GOTPCREL(%rip), %rax
	jmp	LBB0_21
LBB0_18:
	leaq	L_.str.1(%rip), %rdi
	callq	_FIXME
	movq	_D3DERR_OUTOFVIDEOMEMORY@GOTPCREL(%rip), %rax
	jmp	LBB0_21
LBB0_19:
	movq	(%r13), %rsi
	leaq	L_.str.2(%rip), %rdi
	callq	_WARN
	movq	(%r15), %rdi
	callq	_heap_free
LBB0_20:
	movq	_E_FAIL@GOTPCREL(%rip), %rax
LBB0_21:
	movl	(%rax), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"d3d9_elements %p, wined3d_elements %p, element_count %p\n"

	.comm	_E_FAIL,4,2                     ## @E_FAIL
L_.str.1:                               ## @.str.1
	.asciz	"Memory allocation failed\n"

	.comm	_D3DERR_OUTOFVIDEOMEMORY,4,2    ## @D3DERR_OUTOFVIDEOMEMORY
	.comm	_d3d_dtype_lookup,8,3           ## @d3d_dtype_lookup
L_.str.2:                               ## @.str.2
	.asciz	"Invalid element type %#x.\n"

	.comm	_WINED3D_OUTPUT_SLOT_SEMANTIC,4,2 ## @WINED3D_OUTPUT_SLOT_SEMANTIC
	.comm	_WINED3D_INPUT_PER_VERTEX_DATA,4,2 ## @WINED3D_INPUT_PER_VERTEX_DATA
	.comm	_D3D_OK,4,2                     ## @D3D_OK
	.no_dead_strip	_convert_to_wined3d_declaration
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function convert_to_wined3d_declaration
_convert_to_wined3d_declaration:        ; @convert_to_wined3d_declaration
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x20, x2
	mov	x19, x1
	mov	x21, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x21
	mov	x2, x19
	mov	x3, x20
	bl	_TRACE
	add	x9, x21, #24
	mov	w8, #-1
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x9]
	cmp	w10, #255
	b.eq	LBB0_4
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	add	x9, x9, #32
	sub	w8, w8, #1
	cmn	w8, #129
	b.ne	LBB0_1
; %bb.3:
	mov	w23, #129
	b	LBB0_6
LBB0_4:
	cmn	w8, #128
	b.eq	LBB0_14
; %bb.5:
	neg	w23, w8
LBB0_6:
	sub	w22, w23, #1
	add	w8, w22, w22, lsl #1
	lsl	w0, w8, #4
	bl	_heap_alloc
	str	x0, [x19]
	cbz	x0, LBB0_12
; %bb.7:
	cmp	w23, #2
	b.lo	LBB0_11
; %bb.8:
	mov	x23, #0
Lloh2:
	adrp	x24, _d3d_dtype_lookup@GOTPAGE
Lloh3:
	ldr	x24, [x24, _d3d_dtype_lookup@GOTPAGEOFF]
	ldr	x0, [x24]
	mov	w8, #48
	umull	x25, w22, w8
Lloh4:
	adrp	x26, _WINED3D_OUTPUT_SLOT_SEMANTIC@GOTPAGE
Lloh5:
	ldr	x26, [x26, _WINED3D_OUTPUT_SLOT_SEMANTIC@GOTPAGEOFF]
Lloh6:
	adrp	x27, _WINED3D_INPUT_PER_VERTEX_DATA@GOTPAGE
Lloh7:
	ldr	x27, [x27, _WINED3D_INPUT_PER_VERTEX_DATA@GOTPAGEOFF]
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x28, [x21]
	bl	_ARRAY_SIZE
	cmp	x28, x0
	b.hs	LBB0_13
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	x0, [x24]
	ldr	x8, [x21]
	ldr	w8, [x0, x8, lsl #2]
	ldr	x9, [x19]
	add	x9, x9, x23
	str	w8, [x9, #40]
	ldur	d0, [x21, #20]
	str	d0, [x9, #32]
	ldr	w8, [x26]
	str	w8, [x9, #28]
	ldr	w8, [x27]
	str	w8, [x9, #24]
	str	xzr, [x9, #16]
	ldr	w8, [x21, #16]
	str	w8, [x9, #8]
	ldr	d0, [x21, #8]
	str	d0, [x9]
	add	x23, x23, #48
	add	x21, x21, #32
	cmp	x25, x23
	b.ne	LBB0_9
LBB0_11:
	str	w22, [x20]
Lloh8:
	adrp	x8, _D3D_OK@GOTPAGE
Lloh9:
	ldr	x8, [x8, _D3D_OK@GOTPAGEOFF]
	b	LBB0_15
LBB0_12:
Lloh10:
	adrp	x0, l_.str.1@PAGE
Lloh11:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_FIXME
Lloh12:
	adrp	x8, _D3DERR_OUTOFVIDEOMEMORY@GOTPAGE
Lloh13:
	ldr	x8, [x8, _D3DERR_OUTOFVIDEOMEMORY@GOTPAGEOFF]
	b	LBB0_15
LBB0_13:
	ldr	x1, [x21]
Lloh14:
	adrp	x0, l_.str.2@PAGE
Lloh15:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_WARN
	ldr	x0, [x19]
	bl	_heap_free
LBB0_14:
Lloh16:
	adrp	x8, _E_FAIL@GOTPAGE
Lloh17:
	ldr	x8, [x8, _E_FAIL@GOTPAGEOFF]
LBB0_15:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"d3d9_elements %p, wined3d_elements %p, element_count %p\n"

	.comm	_E_FAIL,4,2                     ; @E_FAIL
l_.str.1:                               ; @.str.1
	.asciz	"Memory allocation failed\n"

	.comm	_D3DERR_OUTOFVIDEOMEMORY,4,2    ; @D3DERR_OUTOFVIDEOMEMORY
	.comm	_d3d_dtype_lookup,8,3           ; @d3d_dtype_lookup
l_.str.2:                               ; @.str.2
	.asciz	"Invalid element type %#x.\n"

	.comm	_WINED3D_OUTPUT_SLOT_SEMANTIC,4,2 ; @WINED3D_OUTPUT_SLOT_SEMANTIC
	.comm	_WINED3D_INPUT_PER_VERTEX_DATA,4,2 ; @WINED3D_INPUT_PER_VERTEX_DATA
	.comm	_D3D_OK,4,2                     ; @D3D_OK
	.no_dead_strip	_convert_to_wined3d_declaration
.subsections_via_symbols
