	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_drm_getmagic                   ## -- Begin function drm_getmagic
	.p2align	4, 0x90
_drm_getmagic:                          ## @drm_getmagic
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	8(%rdx), %rsi
	testq	%rsi, %rsi
	je	LBB0_1
## %bb.5:
	movq	%rsi, (%rbx)
	jmp	LBB0_4
LBB0_1:
	movq	%rdx, %r14
	leaq	_drm_getmagic.lock(%rip), %r15
	movl	$1, %r12d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	_spin_lock
	movq	_drm_getmagic.sequence(%rip), %rax
	testq	%rax, %rax
	cmoveq	%r12, %rax
	leaq	1(%rax), %rcx
	movq	%rcx, _drm_getmagic.sequence(%rip)
	movq	%rax, (%rbx)
	movq	%r15, %rdi
	callq	_spin_unlock
	movl	(%r14), %edi
	movq	(%rbx), %rsi
	callq	_drm_find_file
	testq	%rax, %rax
	jne	LBB0_2
## %bb.3:
	movq	(%rbx), %rdx
	movq	%rdx, 8(%r14)
	movl	(%r14), %edi
	movq	%r14, %rsi
	callq	_drm_add_magic
	movq	(%rbx), %rsi
LBB0_4:
	leaq	L_.str(%rip), %rdi
	callq	_DRM_DEBUG
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_drm_getmagic.sequence,8,3 ## @drm_getmagic.sequence
.zerofill __DATA,__bss,_drm_getmagic.lock,4,2 ## @drm_getmagic.lock
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%u\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_drm_getmagic                   ; -- Begin function drm_getmagic
	.p2align	2
_drm_getmagic:                          ; @drm_getmagic
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x1
	ldr	x1, [x2, #8]
	cbz	x1, LBB0_2
; %bb.1:
	str	x1, [x19]
	b	LBB0_5
LBB0_2:
	mov	x20, x2
Lloh0:
	adrp	x21, _drm_getmagic.lock@PAGE
Lloh1:
	add	x21, x21, _drm_getmagic.lock@PAGEOFF
	adrp	x22, _drm_getmagic.sequence@PAGE
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	bl	_spin_lock
	ldr	x8, [x22, _drm_getmagic.sequence@PAGEOFF]
	cmp	x8, #0
	csinc	x8, x8, xzr, ne
	add	x9, x8, #1
	str	x9, [x22, _drm_getmagic.sequence@PAGEOFF]
	str	x8, [x19]
	mov	x0, x21
	bl	_spin_unlock
	ldr	w0, [x20]
	ldr	x1, [x19]
	bl	_drm_find_file
	cbnz	x0, LBB0_3
; %bb.4:
	ldr	x2, [x19]
	str	x2, [x20, #8]
	ldr	w0, [x20]
	mov	x1, x20
	bl	_drm_add_magic
	ldr	x1, [x19]
LBB0_5:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG
	mov	w0, #0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_drm_getmagic.sequence,8,3 ; @drm_getmagic.sequence
.zerofill __DATA,__bss,_drm_getmagic.lock,4,2 ; @drm_getmagic.lock
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%u\n"

.subsections_via_symbols
