	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_svchax_init                    ## -- Begin function svchax_init
	.p2align	4, 0x90
_svchax_init:                           ## @svchax_init
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r15d
	leaq	-44(%rbp), %rdi
	callq	_APT_CheckNew3DS
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_osGetKernelVersion
	movq	%rax, %r14
	movq	___ctr_svchax@GOTPCREL(%rip), %rbx
	cmpl	$0, (%rbx)
	je	LBB0_1
## %bb.10:
	testl	%r15d, %r15d
	jne	LBB0_11
	jmp	LBB0_16
LBB0_1:
	movq	___service_ptr@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_9
## %bb.2:
	movl	$2, %edi
	movl	$50, %esi
	movl	$11, %edx
	callq	_SYSTEM_VERSION
	cmpq	%rax, %r14
	jle	LBB0_4
## %bb.3:
	leaq	-56(%rbp), %rdi
	leaq	-64(%rbp), %rsi
	callq	_get_luma_version
	testq	%rax, %rax
	setne	%al
	cmpq	$8, -56(%rbp)
	setl	%cl
	orb	%al, %cl
	movzbl	%cl, %edi
	callq	_R_FAILED
	testq	%rax, %rax
	je	LBB0_4
## %bb.15:
	movl	$-1, %r12d
	jmp	LBB0_16
LBB0_4:
	movl	$2, %edi
	movl	$46, %esi
	xorl	%edx, %edx
	callq	_SYSTEM_VERSION
	cmpq	%rax, %r14
	jle	LBB0_7
## %bb.5:
	movl	$2, %edi
	movl	$50, %esi
	movl	$11, %edx
	callq	_SYSTEM_VERSION
	cmpq	%rax, %r14
	jle	LBB0_6
LBB0_7:
	movl	$2, %edi
	movl	$46, %esi
	xorl	%edx, %edx
	callq	_SYSTEM_VERSION
	cmpq	%rax, %r14
	jg	LBB0_9
## %bb.8:
	xorl	%eax, %eax
	callq	_do_memchunkhax1
	jmp	LBB0_9
LBB0_6:
	xorl	%eax, %eax
	callq	_do_memchunkhax2
LBB0_9:
	movq	_k_enable_all_svcs@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	-44(%rbp), %esi
	callq	_svc_7b
	movl	$1, (%rbx)
	testl	%r15d, %r15d
	je	LBB0_16
LBB0_11:
	movq	___ctr_svchax_srv@GOTPCREL(%rip), %r13
	cmpl	$0, (%r13)
	jne	LBB0_16
## %bb.12:
	movq	_CURRENT_KPROCESS@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	callq	_read_kaddr
	movq	%rax, %r15
	movl	$188, %ebx
	cmpl	$0, -44(%rbp)
	jne	LBB0_14
## %bb.13:
	movl	$2, %edi
	movl	$40, %esi
	xorl	%edx, %edx
	callq	_SYSTEM_VERSION
	xorl	%ecx, %ecx
	cmpq	%rax, %r14
	setg	%cl
	leaq	172(,%rcx,8), %rbx
LBB0_14:
	addq	%r15, %rbx
	movq	%rbx, %rdi
	callq	_read_kaddr
	movq	%rax, %r14
	xorl	%r12d, %r12d
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_write_kaddr
	xorl	%eax, %eax
	callq	_srvExit
	xorl	%eax, %eax
	callq	_srvInit
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_write_kaddr
	movl	$1, (%r13)
LBB0_16:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	___ctr_svchax,4,2               ## @__ctr_svchax
	.comm	___service_ptr,8,3              ## @__service_ptr
	.comm	_k_enable_all_svcs,8,3          ## @k_enable_all_svcs
	.comm	___ctr_svchax_srv,4,2           ## @__ctr_svchax_srv
	.comm	_CURRENT_KPROCESS,8,3           ## @CURRENT_KPROCESS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_svchax_init                    ; -- Begin function svchax_init
	.p2align	2
_svchax_init:                           ; @svchax_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x20, x0
	add	x0, sp, #28
	bl	_APT_CheckNew3DS
	bl	_osGetKernelVersion
	mov	x19, x0
Lloh0:
	adrp	x21, ___ctr_svchax@GOTPAGE
Lloh1:
	ldr	x21, [x21, ___ctr_svchax@GOTPAGEOFF]
	ldr	w8, [x21]
	cbz	w8, LBB0_2
; %bb.1:
	mov	w0, #0
	cbnz	w20, LBB0_12
	b	LBB0_17
LBB0_2:
Lloh2:
	adrp	x8, ___service_ptr@GOTPAGE
Lloh3:
	ldr	x8, [x8, ___service_ptr@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cbz	x8, LBB0_11
; %bb.3:
	mov	w0, #2
	mov	w1, #50
	mov	w2, #11
	bl	_SYSTEM_VERSION
	cmp	x19, x0
	b.le	LBB0_6
; %bb.4:
	add	x0, sp, #16
	add	x1, sp, #8
	bl	_get_luma_version
	cmp	x0, #0
	ldr	x8, [sp, #16]
	ccmp	x8, #8, #8, eq
	cset	w0, lt
	bl	_R_FAILED
	cbz	x0, LBB0_6
; %bb.5:
	mov	w0, #-1
	b	LBB0_17
LBB0_6:
	mov	w0, #2
	mov	w1, #46
	mov	w2, #0
	bl	_SYSTEM_VERSION
	cmp	x19, x0
	b.le	LBB0_8
; %bb.7:
	mov	w0, #2
	mov	w1, #50
	mov	w2, #11
	bl	_SYSTEM_VERSION
	cmp	x19, x0
	b.le	LBB0_10
LBB0_8:
	mov	w0, #2
	mov	w1, #46
	mov	w2, #0
	bl	_SYSTEM_VERSION
	cmp	x19, x0
	b.gt	LBB0_11
; %bb.9:
	bl	_do_memchunkhax1
	b	LBB0_11
LBB0_10:
	bl	_do_memchunkhax2
LBB0_11:
Lloh5:
	adrp	x8, _k_enable_all_svcs@GOTPAGE
Lloh6:
	ldr	x8, [x8, _k_enable_all_svcs@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	ldr	w1, [sp, #28]
	bl	_svc_7b
	mov	w8, #1
	str	w8, [x21]
	mov	w0, #0
	cbz	w20, LBB0_17
LBB0_12:
Lloh8:
	adrp	x21, ___ctr_svchax_srv@GOTPAGE
Lloh9:
	ldr	x21, [x21, ___ctr_svchax_srv@GOTPAGEOFF]
	ldr	w8, [x21]
	cbnz	w8, LBB0_17
; %bb.13:
Lloh10:
	adrp	x8, _CURRENT_KPROCESS@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CURRENT_KPROCESS@GOTPAGEOFF]
Lloh12:
	ldr	x0, [x8]
	bl	_read_kaddr
	mov	x20, x0
	ldr	w8, [sp, #28]
	cbz	w8, LBB0_15
; %bb.14:
	mov	w8, #188
	b	LBB0_16
LBB0_15:
	mov	w0, #2
	mov	w1, #40
	mov	w2, #0
	bl	_SYSTEM_VERSION
	mov	w8, #172
	mov	w9, #180
	cmp	x19, x0
	csel	x8, x9, x8, gt
LBB0_16:
	add	x19, x8, x20
	mov	x0, x19
	bl	_read_kaddr
	mov	x20, x0
	mov	x0, x19
	mov	x1, #0
	bl	_write_kaddr
	bl	_srvExit
	bl	_srvInit
	mov	x0, x19
	mov	x1, x20
	bl	_write_kaddr
	mov	w0, #0
	mov	w8, #1
	str	w8, [x21]
LBB0_17:
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	___ctr_svchax,4,2               ; @__ctr_svchax
	.comm	___service_ptr,8,3              ; @__service_ptr
	.comm	_k_enable_all_svcs,8,3          ; @k_enable_all_svcs
	.comm	___ctr_svchax_srv,4,2           ; @__ctr_svchax_srv
	.comm	_CURRENT_KPROCESS,8,3           ; @CURRENT_KPROCESS
.subsections_via_symbols
