	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hl_mem_ioctl                   ## -- Begin function hl_mem_ioctl
	.p2align	4, 0x90
_hl_mem_ioctl:                          ## @hl_mem_ioctl
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movq	(%rdi), %r15
	movq	8(%rdi), %r12
	movl	$0, -40(%rbp)
	movl	$0, -36(%rbp)
	movq	%r12, %rdi
	callq	_hl_device_disabled_or_in_reset
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movl	(%r12), %ebx
	addq	$12, %r12
	movq	%r12, %rdi
	callq	_atomic_read
	testq	%rax, %rax
	leaq	L_.str.2(%rip), %rax
	leaq	L_.str.1(%rip), %rdx
	cmoveq	%rax, %rdx
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edi
	callq	_dev_warn_ratelimited
	movq	_EBUSY@GOTPCREL(%rip), %rax
LBB0_15:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_16:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	cmpl	$0, 8(%r12)
	je	LBB0_17
## %bb.3:
	movl	(%r14), %eax
	addl	$-128, %eax
	cmpl	$3, %eax
	ja	LBB0_14
## %bb.4:
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rax
	addq	%rcx, %rax
	jmpq	*%rax
LBB0_13:
	movl	4(%r14), %esi
	movq	%r15, %rdi
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_unmap_device_va                ## TAILCALL
LBB0_17:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mem_ioctl_no_mmu               ## TAILCALL
LBB0_14:
	movl	(%r12), %edi
	leaq	L_.str.5(%rip), %rsi
	callq	_dev_err
	movq	_ENOTTY@GOTPCREL(%rip), %rax
	jmp	LBB0_15
LBB0_12:
	leaq	-40(%rbp), %rdx
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_map_device_va
	movl	%eax, %ebx
	movq	%r14, %rdi
	xorl	%esi, %esi
	movl	$16, %edx
	callq	_memset
	movl	-40(%rbp), %eax
	movl	%eax, (%r14)
	jmp	LBB0_16
LBB0_11:
	movl	8(%r14), %esi
	movq	%r15, %rdi
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_free_device_memory             ## TAILCALL
LBB0_5:
	cmpl	$0, 4(%r12)
	je	LBB0_6
## %bb.8:
	cmpl	$0, 12(%r14)
	je	LBB0_9
## %bb.10:
	leaq	-36(%rbp), %rdx
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_alloc_device_memory
	movl	%eax, %ebx
	movq	%r14, %rdi
	xorl	%esi, %esi
	movl	$16, %edx
	callq	_memset
	movl	-36(%rbp), %eax
	movl	%eax, 4(%r14)
	jmp	LBB0_16
LBB0_6:
	movl	(%r12), %edi
	leaq	L_.str.3(%rip), %rsi
	jmp	LBB0_7
LBB0_9:
	movl	(%r12), %edi
	leaq	L_.str.4(%rip), %rsi
LBB0_7:
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_15
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_13, LBB0_13-LJTI0_0
.set L0_0_set_12, LBB0_12-LJTI0_0
.set L0_0_set_11, LBB0_11-LJTI0_0
.set L0_0_set_5, LBB0_5-LJTI0_0
LJTI0_0:
	.long	L0_0_set_13
	.long	L0_0_set_12
	.long	L0_0_set_11
	.long	L0_0_set_5
	.end_data_region
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Device is %s. Can't execute MEMORY IOCTL\n"

L_.str.1:                               ## @.str.1
	.asciz	"in_reset"

L_.str.2:                               ## @.str.2
	.asciz	"disabled"

	.comm	_EBUSY,4,2                      ## @EBUSY
L_.str.3:                               ## @.str.3
	.asciz	"DRAM alloc is not supported\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.4:                               ## @.str.4
	.asciz	"alloc size must be larger than 0\n"

L_.str.5:                               ## @.str.5
	.asciz	"Unknown opcode for memory IOCTL\n"

	.comm	_ENOTTY,4,2                     ## @ENOTTY
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hl_mem_ioctl                   ; -- Begin function hl_mem_ioctl
	.p2align	2
_hl_mem_ioctl:                          ; @hl_mem_ioctl
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x1
	mov	x22, x0
	ldp	x20, x21, [x0]
	str	xzr, [sp, #8]
	mov	x0, x21
	bl	_hl_device_disabled_or_in_reset
	cbz	x0, LBB0_4
; %bb.1:
	ldr	w19, [x21], #12
	mov	x0, x21
	bl	_atomic_read
Lloh0:
	adrp	x8, l_.str.1@PAGE
Lloh1:
	add	x8, x8, l_.str.1@PAGEOFF
Lloh2:
	adrp	x9, l_.str.2@PAGE
Lloh3:
	add	x9, x9, l_.str.2@PAGEOFF
	cmp	x0, #0
	csel	x2, x9, x8, eq
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_dev_warn_ratelimited
Lloh6:
	adrp	x8, _EBUSY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_3:
	mov	x0, x20
	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
	add	sp, sp, #64
	ret
LBB0_4:
	ldr	w8, [x21, #8]
	cbz	w8, LBB0_8
; %bb.5:
	ldr	w8, [x19]
	sub	w8, w8, #128
	cmp	w8, #3
	b.hi	LBB0_9
; %bb.6:
Lloh8:
	adrp	x9, lJTI0_0@PAGE
Lloh9:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_7
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_7:
	ldr	w1, [x19, #4]
	mov	x0, x20
	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
	add	sp, sp, #64
	b	_unmap_device_va
LBB0_8:
	mov	x0, x22
	mov	x1, x19
	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
	add	sp, sp, #64
	b	_mem_ioctl_no_mmu
LBB0_9:
	ldr	w0, [x21]
Lloh10:
	adrp	x1, l_.str.5@PAGE
Lloh11:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_dev_err
Lloh12:
	adrp	x8, _ENOTTY@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENOTTY@GOTPAGEOFF]
	b	LBB0_2
LBB0_10:
	add	x2, sp, #12
	mov	x0, x20
	mov	x1, x19
	bl	_map_device_va
	mov	x20, x0
	mov	x0, x19
	mov	w1, #0
	mov	w2, #16
	bl	_memset
	ldr	w8, [sp, #12]
	str	w8, [x19]
	b	LBB0_3
LBB0_11:
	ldr	w1, [x19, #8]
	mov	x0, x20
	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
	add	sp, sp, #64
	b	_free_device_memory
LBB0_12:
	ldr	w8, [x21, #4]
	cbz	w8, LBB0_15
; %bb.13:
	ldr	w8, [x19, #12]
	cbz	w8, LBB0_16
; %bb.14:
	add	x2, sp, #8
	mov	x0, x20
	mov	x1, x19
	bl	_alloc_device_memory
	mov	x20, x0
	mov	x0, x19
	mov	w1, #0
	mov	w2, #16
	bl	_memset
	ldr	w8, [sp, #8]
	str	w8, [x19, #4]
	b	LBB0_3
LBB0_15:
	ldr	w0, [x21]
Lloh14:
	adrp	x1, l_.str.3@PAGE
Lloh15:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_17
LBB0_16:
	ldr	w0, [x21]
Lloh16:
	adrp	x1, l_.str.4@PAGE
Lloh17:
	add	x1, x1, l_.str.4@PAGEOFF
LBB0_17:
	bl	_dev_err
Lloh18:
	adrp	x8, _EINVAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_7-LBB0_7)>>2
	.byte	(LBB0_10-LBB0_7)>>2
	.byte	(LBB0_11-LBB0_7)>>2
	.byte	(LBB0_12-LBB0_7)>>2
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Device is %s. Can't execute MEMORY IOCTL\n"

l_.str.1:                               ; @.str.1
	.asciz	"in_reset"

l_.str.2:                               ; @.str.2
	.asciz	"disabled"

	.comm	_EBUSY,4,2                      ; @EBUSY
l_.str.3:                               ; @.str.3
	.asciz	"DRAM alloc is not supported\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.4:                               ; @.str.4
	.asciz	"alloc size must be larger than 0\n"

l_.str.5:                               ; @.str.5
	.asciz	"Unknown opcode for memory IOCTL\n"

	.comm	_ENOTTY,4,2                     ; @ENOTTY
.subsections_via_symbols
