	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WriteKernelMemory              ## -- Begin function WriteKernelMemory
	.p2align	4, 0x90
_WriteKernelMemory:                     ## @WriteKernelMemory
	.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
	movl	$0, -44(%rbp)
	movq	_gHandleDriver@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_6
## %bb.1:
	movl	%edx, %r14d
	movq	%rsi, %r12
	movl	%edi, %r13d
	leal	4(%r14), %r15d
	movl	%r15d, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_2
## %bb.3:
	movq	%rax, %rbx
	movl	%r13d, 8(%rax)
	movl	%r14d, (%rax)
	movq	%rax, %rdi
	addq	$4, %rdi
	movq	%r12, %rsi
	movl	%r14d, %edx
	callq	_memcpy
	movq	_gHandleDriver@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	_IOCTL_WRITE_KERNEL_MEM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rax
	movq	%rbx, %rdx
	movl	%r15d, %ecx
	movq	%rbx, %r8
	movl	%r15d, %r9d
	pushq	$0
	pushq	%rax
	callq	_DeviceIoControl
	addq	$16, %rsp
	testq	%rax, %rax
	jne	LBB0_5
## %bb.4:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_eprintf
	movl	$-1, %r14d
LBB0_5:
	movq	%rbx, %rdi
	callq	_free
	jmp	LBB0_8
LBB0_6:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_eprintf
	jmp	LBB0_7
LBB0_2:
	leaq	L_.str(%rip), %rdi
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	_eprintf
LBB0_7:
	movl	$-1, %r14d
LBB0_8:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_gHandleDriver,8,3              ## @gHandleDriver
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"[r2k] WriteKernelMemory: Error can't allocate %i bytes of memory.\n"

	.comm	_IOCTL_WRITE_KERNEL_MEM,4,2     ## @IOCTL_WRITE_KERNEL_MEM
L_.str.1:                               ## @.str.1
	.asciz	"[r2k] WriteKernelMemory: Error IOCTL_WRITE_KERNEL_MEM.\n"

L_.str.2:                               ## @.str.2
	.asciz	"Driver not initialized.\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WriteKernelMemory              ; -- Begin function WriteKernelMemory
	.p2align	2
_WriteKernelMemory:                     ; @WriteKernelMemory
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	str	wzr, [sp, #12]
Lloh0:
	adrp	x24, _gHandleDriver@GOTPAGE
Lloh1:
	ldr	x24, [x24, _gHandleDriver@GOTPAGEOFF]
	ldr	x8, [x24]
	cbz	x8, LBB0_5
; %bb.1:
	mov	x19, x2
	mov	x22, x1
	mov	x23, x0
	add	w21, w2, #4
	mov	x0, x21
	bl	_malloc
	cbz	x0, LBB0_6
; %bb.2:
	mov	x20, x0
	str	w23, [x0, #8]
	str	w19, [x0], #4
	mov	x1, x22
	mov	x2, x19
	bl	_memcpy
	ldr	x0, [x24]
Lloh2:
	adrp	x8, _IOCTL_WRITE_KERNEL_MEM@GOTPAGE
Lloh3:
	ldr	x8, [x8, _IOCTL_WRITE_KERNEL_MEM@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	add	x6, sp, #12
	mov	x2, x20
	mov	x3, x21
	mov	x4, x20
	mov	x5, x21
	mov	x7, #0
	bl	_DeviceIoControl
	cbnz	x0, LBB0_4
; %bb.3:
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_eprintf
	mov	w19, #-1
LBB0_4:
	mov	x0, x20
	bl	_free
	b	LBB0_8
LBB0_5:
Lloh7:
	adrp	x0, l_.str.2@PAGE
Lloh8:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_7
LBB0_6:
	str	x21, [sp]
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
LBB0_7:
	bl	_eprintf
	mov	w19, #-1
LBB0_8:
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_gHandleDriver,8,3              ; @gHandleDriver
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"[r2k] WriteKernelMemory: Error can't allocate %i bytes of memory.\n"

	.comm	_IOCTL_WRITE_KERNEL_MEM,4,2     ; @IOCTL_WRITE_KERNEL_MEM
l_.str.1:                               ; @.str.1
	.asciz	"[r2k] WriteKernelMemory: Error IOCTL_WRITE_KERNEL_MEM.\n"

l_.str.2:                               ; @.str.2
	.asciz	"Driver not initialized.\n"

.subsections_via_symbols
