	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sis_drm_alloc
_sis_drm_alloc:                         ## @sis_drm_alloc
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r12d
	movq	%rdx, %r14
	movq	%rdi, %r15
	xorl	%ebx, %ebx
	testl	%ecx, %ecx
	setne	%bl
	movq	8(%rdi), %r13
	movq	(%rsi), %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	cmpq	$0, (%r13,%rbx,8)
	je	LBB0_1
## %bb.2:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$32, %edi
	callq	_kzalloc
	movq	%rax, %rbx
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	_SIS_MM_ALIGN_MASK@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	addq	(%r14), %rdx
	movq	_SIS_MM_ALIGN_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shrq	%cl, %rdx
	movq	%rdx, (%r14)
	movq	_AGP_TYPE@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	cmpl	%r12d, (%rax)
	sete	%cl
	leaq	36(,%rcx,4), %rdi
	addq	%r13, %rdi
	movq	%rbx, %rsi
	xorl	%ecx, %ecx
	callq	_drm_mm_insert_node
	movq	%r13, %rcx
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_9
## %bb.5:
	movl	%r12d, -44(%rbp)                ## 4-byte Spill
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movq	(%rbx), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	leaq	32(%rcx), %r14
	leaq	-48(%rbp), %r15
	movq	_EAGAIN@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_idr_pre_get
	testq	%rax, %rax
	je	LBB0_7
## %bb.10:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	$1, %edx
	movq	%r15, %rcx
	callq	_idr_get_new_above
	movl	%eax, %r13d
	movl	(%r12), %eax
	addl	%r13d, %eax
	je	LBB0_6
## %bb.11:
	testl	%r13d, %r13d
	jne	LBB0_8
## %bb.12:
	xorl	%r14d, %r14d
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	setne	%r14b
	addq	$8, %rbx
	movq	%rbx, %rdi
	movq	-88(%rbp), %rsi                 ## 8-byte Reload
	callq	_list_add
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movq	_SIS_MM_ALIGN_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	shlq	%cl, %rsi
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	addq	16(%rax,%r14,8), %rsi
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movq	%rsi, 8(%rdx)
	movl	-48(%rbp), %eax
	movl	%eax, 16(%rdx)
	shlq	%cl, (%rdx)
	xorl	%r13d, %r13d
	jmp	LBB0_13
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_DRM_ERROR
	movq	%r15, %rdi
	callq	_mutex_unlock
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_13
LBB0_3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_9
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_8:
	movq	%rbx, %rdi
	callq	_drm_mm_remove_node
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movl	-44(%rbp), %r12d                ## 4-byte Reload
LBB0_9:
	movq	%rbx, %rdi
	callq	_kfree
	movq	%r15, %rdi
	callq	_mutex_unlock
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%r14)
	movl	$0, 16(%r14)
	leaq	L_.str.1(%rip), %rdi
	movl	%r12d, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_DRM_DEBUG
LBB0_13:
	movl	%r13d, %eax
	addq	$56, %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	"Attempt to allocate from uninitialized memory manager.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_SIS_MM_ALIGN_MASK,8,3          ## @SIS_MM_ALIGN_MASK
	.comm	_SIS_MM_ALIGN_SHIFT,8,3         ## @SIS_MM_ALIGN_SHIFT
	.comm	_AGP_TYPE,4,2                   ## @AGP_TYPE
	.comm	_EAGAIN,4,2                     ## @EAGAIN
L_.str.1:                               ## @.str.1
	.asciz	"alloc %d, size = %ld, offset = %ld\n"

	.no_dead_strip	_sis_drm_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sis_drm_alloc
_sis_drm_alloc:                         ; @sis_drm_alloc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x3
	mov	x19, x2
	mov	x21, x0
	cmp	w3, #0
	cset	w22, ne
	ldr	x26, [x0, #8]
	ldr	x23, [x1]
	bl	_mutex_lock
	ldr	x8, [x26, w22, uxtw #3]
	cbz	x8, LBB0_8
; %bb.1:
Lloh0:
	adrp	x28, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x28, [x28, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x28]
	mov	w0, #32
	bl	_kzalloc
	mov	x22, x0
	cbz	x0, LBB0_9
; %bb.2:
	ldr	x8, [x19]
Lloh2:
	adrp	x9, _SIS_MM_ALIGN_MASK@GOTPAGE
Lloh3:
	ldr	x9, [x9, _SIS_MM_ALIGN_MASK@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	add	x8, x9, x8
Lloh5:
	adrp	x9, _SIS_MM_ALIGN_SHIFT@GOTPAGE
Lloh6:
	ldr	x9, [x9, _SIS_MM_ALIGN_SHIFT@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	lsr	x2, x8, x9
Lloh8:
	adrp	x8, _AGP_TYPE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AGP_TYPE@GOTPAGEOFF]
	str	x2, [x19]
Lloh10:
	ldr	w8, [x8]
	add	x9, x26, #36
	add	x10, x26, #40
	cmp	w8, w20
	csel	x0, x10, x9, eq
	mov	x1, x22
	mov	w3, #0
	bl	_drm_mm_insert_node
	mov	x24, x0
	cbnz	w0, LBB0_12
; %bb.3:
	ldr	x8, [x22]
	str	x8, [sp]                        ; 8-byte Folded Spill
	add	x25, x26, #32
Lloh11:
	adrp	x27, _EAGAIN@GOTPAGE
Lloh12:
	ldr	x27, [x27, _EAGAIN@GOTPAGEOFF]
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x28]
	mov	x0, x25
	bl	_idr_pre_get
	cbz	x0, LBB0_10
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x3, sp, #12
	mov	x0, x25
	mov	x1, x22
	mov	w2, #1
	bl	_idr_get_new_above
	ldr	w8, [x27]
	cmn	w0, w8
	b.eq	LBB0_4
; %bb.6:
	mov	x24, x0
	cbnz	w0, LBB0_11
; %bb.7:
	add	x0, x22, #8
	mov	x1, x23
	bl	_list_add
	mov	x0, x21
	bl	_mutex_unlock
	cmp	w20, #0
	mov	w8, #24
	mov	w9, #16
	csel	x8, x9, x8, eq
	ldr	x8, [x26, x8]
Lloh13:
	adrp	x9, _SIS_MM_ALIGN_SHIFT@GOTPAGE
Lloh14:
	ldr	x9, [x9, _SIS_MM_ALIGN_SHIFT@GOTPAGEOFF]
Lloh15:
	ldr	x9, [x9]
	ldr	x10, [sp]                       ; 8-byte Folded Reload
	lsl	x10, x10, x9
	add	x8, x10, x8
	ldr	w10, [sp, #12]
	str	w10, [x19, #16]
	ldr	x10, [x19]
	lsl	x9, x10, x9
	stp	x9, x8, [x19]
	b	LBB0_13
LBB0_8:
Lloh16:
	adrp	x0, l_.str@PAGE
Lloh17:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
	mov	x0, x21
	bl	_mutex_unlock
Lloh18:
	adrp	x8, _EINVAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_13
LBB0_9:
Lloh21:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_12
LBB0_10:
Lloh24:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_11:
	mov	x0, x22
	bl	_drm_mm_remove_node
LBB0_12:
	mov	x0, x22
	bl	_kfree
	mov	x0, x21
	bl	_mutex_unlock
	stp	xzr, xzr, [x19]
	str	wzr, [x19, #16]
Lloh27:
	adrp	x0, l_.str.1@PAGE
Lloh28:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x20
	mov	x2, #0
	mov	x3, #0
	bl	_DRM_DEBUG
LBB0_13:
	mov	x0, x24
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Attempt to allocate from uninitialized memory manager.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_SIS_MM_ALIGN_MASK,8,3          ; @SIS_MM_ALIGN_MASK
	.comm	_SIS_MM_ALIGN_SHIFT,8,3         ; @SIS_MM_ALIGN_SHIFT
	.comm	_AGP_TYPE,4,2                   ; @AGP_TYPE
	.comm	_EAGAIN,4,2                     ; @EAGAIN
l_.str.1:                               ; @.str.1
	.asciz	"alloc %d, size = %ld, offset = %ld\n"

	.no_dead_strip	_sis_drm_alloc
.subsections_via_symbols
