	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vmw_legacy_srf_create
_vmw_legacy_srf_create:                 ## @vmw_legacy_srf_create
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	16(%rdi), %r15
	xorl	%edi, %edi
	cmpl	$-1, (%rbx)
	setne	%dil
	callq	_likely
	xorl	%r14d, %r14d
	testq	%rax, %rax
	jne	LBB0_10
## %bb.1:
	movq	%rbx, %rdi
	callq	_vmw_res_to_srf
	movq	%rax, %r12
	movq	8(%rbx), %rax
	addq	(%r15), %rax
	xorl	%edi, %edi
	cmpq	8(%r15), %rax
	setge	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_10
LBB0_3:
	movq	%rbx, %rdi
	callq	_vmw_resource_alloc_id
	movl	%eax, %r13d
	xorl	%edi, %edi
	testl	%eax, %eax
	setne	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	leaq	L_.str(%rip), %rdi
	callq	_DRM_ERROR
	movl	%r13d, %r14d
	jmp	LBB0_10
LBB0_5:
	movl	(%rbx), %eax
	movq	_SVGA3D_MAX_SURFACE_IDS@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpl	(%rcx), %eax
	setge	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_7:
	movq	%r12, %rdi
	callq	_vmw_surface_define_size
	movq	%r15, %rdi
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%eax, %esi
	callq	_VMW_FIFO_RESERVE
	movq	%rax, %r13
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_11
## %bb.8:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_9:
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	movq	%rbx, %rdi
	callq	_vmw_resource_release_id
LBB0_10:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	_vmw_surface_define_encode
	movq	%r15, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_vmw_fifo_commit
	movq	%r15, %rdi
	callq	_vmw_fifo_resource_inc
	movq	8(%rbx), %rax
	addq	%rax, (%r15)
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_EBUSY,4,2                      ## @EBUSY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to allocate a surface id.\n"

	.comm	_SVGA3D_MAX_SURFACE_IDS,4,2     ## @SVGA3D_MAX_SURFACE_IDS
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_vmw_legacy_srf_create
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vmw_legacy_srf_create
_vmw_legacy_srf_create:                 ; @vmw_legacy_srf_create
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x0
	ldr	x20, [x0, #16]
	ldr	w8, [x0]
	cmn	w8, #1
	cset	w0, ne
	bl	_likely
	cbz	x0, LBB0_2
; %bb.1:
	mov	w22, #0
	b	LBB0_11
LBB0_2:
	mov	x0, x19
	bl	_vmw_res_to_srf
	mov	x21, x0
	ldr	x8, [x19, #8]
	ldp	x9, x10, [x20]
	add	x8, x8, x9
	cmp	x8, x10
	cset	w0, ge
	bl	_unlikely
	cbz	x0, LBB0_4
; %bb.3:
Lloh0:
	adrp	x8, _EBUSY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_11
LBB0_4:
	mov	x0, x19
	bl	_vmw_resource_alloc_id
	mov	x22, x0
	cmp	w0, #0
	cset	w0, ne
	bl	_unlikely
	cbz	x0, LBB0_6
; %bb.5:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
	b	LBB0_11
LBB0_6:
	ldr	w8, [x19]
Lloh5:
	adrp	x9, _SVGA3D_MAX_SURFACE_IDS@GOTPAGE
Lloh6:
	ldr	x9, [x9, _SVGA3D_MAX_SURFACE_IDS@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	cmp	w8, w9
	cset	w0, ge
	bl	_unlikely
	cbz	x0, LBB0_8
; %bb.7:
Lloh8:
	adrp	x8, _EBUSY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_10
LBB0_8:
	mov	x0, x21
	bl	_vmw_surface_define_size
	mov	x22, x0
	mov	x0, x20
	mov	x1, x22
	bl	_VMW_FIFO_RESERVE
	mov	x23, x0
	cmp	x0, #0
	cset	w0, eq
	bl	_unlikely
	cbz	x0, LBB0_12
; %bb.9:
Lloh10:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
	neg	w22, w8
	mov	x0, x19
	bl	_vmw_resource_release_id
LBB0_11:
	mov	x0, x22
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_12:
	mov	x0, x21
	mov	x1, x23
	bl	_vmw_surface_define_encode
	mov	x0, x20
	mov	x1, x22
	bl	_vmw_fifo_commit
	mov	x0, x20
	bl	_vmw_fifo_resource_inc
	mov	w22, #0
	ldr	x8, [x19, #8]
	ldr	x9, [x20]
	add	x8, x9, x8
	str	x8, [x20]
	b	LBB0_11
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_EBUSY,4,2                      ; @EBUSY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to allocate a surface id.\n"

	.comm	_SVGA3D_MAX_SURFACE_IDS,4,2     ; @SVGA3D_MAX_SURFACE_IDS
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_vmw_legacy_srf_create
.subsections_via_symbols
