	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_Discord_Register               ## -- Begin function Discord_Register
	.p2align	4, 0x90
_Discord_Register:                      ## @Discord_Register
	.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
	movl	$5392, %eax                     ## imm = 0x1510
	callq	____chkstk_darwin
	subq	%rax, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -40(%rbp)
	leaq	L_.str(%rip), %rdi
	callq	_getenv
	testq	%rax, %rax
	je	LBB0_12
## %bb.1:
	movq	%rax, %r12
	testq	%rbx, %rbx
	je	LBB0_3
## %bb.2:
	cmpb	$0, (%rbx)
	jne	LBB0_5
LBB0_3:
	leaq	L_.str.1(%rip), %rdi
	leaq	-5424(%rbp), %rbx
	movq	%rbx, %rsi
	movl	$1024, %edx                     ## imm = 0x400
	callq	_readlink
	leaq	-1024(%rax), %rcx
	cmpq	$-1023, %rcx                    ## imm = 0xFC01
	jb	LBB0_12
## %bb.4:
	movb	$0, -5424(%rbp,%rax)
LBB0_5:
	leaq	L_.str.2(%rip), %rdx
	leaq	-4400(%rbp), %rdi
	movl	$2048, %esi                     ## imm = 0x800
	movq	%r15, %rcx
	movq	%rbx, %r8
	movq	%r15, %r9
	xorl	%eax, %eax
	callq	_snprintf
	testl	%eax, %eax
	jle	LBB0_12
## %bb.6:
	movl	%eax, %r14d
	leaq	L_.str.3(%rip), %rdx
	leaq	-1328(%rbp), %rdi
	movl	$256, %esi                      ## imm = 0x100
	movq	%r15, %rcx
	xorl	%eax, %eax
	callq	_snprintf
	leaq	L_.str.4(%rip), %rdx
	leaq	-2352(%rbp), %rbx
	movq	%rbx, %rdi
	movl	$1024, %esi                     ## imm = 0x400
	movq	%r12, %rcx
	xorl	%eax, %eax
	callq	_snprintf
	movq	%rbx, %rdi
	callq	_Mkdir
	testl	%eax, %eax
	je	LBB0_12
## %bb.7:
	leaq	L_.str.5(%rip), %rsi
	leaq	-2352(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_strcat
	movq	%rbx, %rdi
	callq	_Mkdir
	testl	%eax, %eax
	je	LBB0_12
## %bb.8:
	leaq	L_.str.6(%rip), %rsi
	leaq	-2352(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_strcat
	movq	%rbx, %rdi
	callq	_Mkdir
	testl	%eax, %eax
	je	LBB0_12
## %bb.9:
	leaq	-2352(%rbp), %rbx
	leaq	-1328(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_strcat
	leaq	L_.str.7(%rip), %rsi
	movq	%rbx, %rdi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_12
## %bb.10:
	movq	%rax, %rbx
	leaq	-4400(%rbp), %rdi
	movl	$1, %esi
	movl	%r14d, %edx
	movq	%rax, %rcx
	callq	_fwrite
	movq	%rbx, %rdi
	callq	_fclose
	leaq	L_.str.8(%rip), %rdx
	leaq	-1072(%rbp), %rbx
	movq	%rbx, %rdi
	movl	$1024, %esi                     ## imm = 0x400
	movq	%r15, %rcx
	movq	%r15, %r8
	xorl	%eax, %eax
	callq	_snprintf
	movq	%rbx, %rdi
	callq	_system
	testq	%rax, %rax
	jns	LBB0_12
## %bb.11:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.9(%rip), %rsi
	callq	_fprintf
LBB0_12:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-40(%rbp), %rax
	jne	LBB0_14
## %bb.13:
	addq	$5392, %rsp                     ## imm = 0x1510
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"HOME"

L_.str.1:                               ## @.str.1
	.asciz	"/proc/self/exe"

L_.str.2:                               ## @.str.2
	.asciz	"[Desktop Entry]\nName=Game %s\nExec=%s\nType=Application\nNoDisplay=true\nCategories=Discord;Games;\nMimeType=x-scheme-handler/discord-%s;\n"

L_.str.3:                               ## @.str.3
	.asciz	"/discord-%s.desktop"

L_.str.4:                               ## @.str.4
	.asciz	"%s/.local"

L_.str.5:                               ## @.str.5
	.asciz	"/share"

L_.str.6:                               ## @.str.6
	.asciz	"/applications"

L_.str.7:                               ## @.str.7
	.asciz	"w"

L_.str.8:                               ## @.str.8
	.asciz	"xdg-mime default discord-%s.desktop x-scheme-handler/discord-%s"

	.comm	_stderr,4,2                     ## @stderr
L_.str.9:                               ## @.str.9
	.asciz	"Failed to register mime handler\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_Discord_Register               ; -- Begin function Discord_Register
	.p2align	2
_Discord_Register:                      ; @Discord_Register
	.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	w9, #5408
Lloh0:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh1:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	sub	sp, sp, #1, lsl #12             ; =4096
	sub	sp, sp, #1312
	mov	x20, x1
	mov	x19, x0
Lloh2:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh3:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	stur	x8, [x29, #-40]
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_getenv
	cbz	x0, LBB0_12
; %bb.1:
	mov	x21, x0
	cbz	x20, LBB0_3
; %bb.2:
	ldrb	w8, [x20]
	cbnz	w8, LBB0_5
LBB0_3:
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	add	x20, sp, #24
	add	x1, sp, #24
	mov	w2, #1024
	bl	_readlink
	sub	x8, x0, #1024
	cmn	x8, #1023
	b.lo	LBB0_12
; %bb.4:
	strb	wzr, [x20, x0]
LBB0_5:
	stp	x20, x19, [sp]
Lloh9:
	adrp	x2, l_.str.2@PAGE
Lloh10:
	add	x2, x2, l_.str.2@PAGEOFF
	add	x0, sp, #1048
	mov	w1, #2048
	mov	x3, x19
	bl	_snprintf
	cmp	w0, #1
	b.lt	LBB0_12
; %bb.6:
	mov	x20, x0
Lloh11:
	adrp	x2, l_.str.3@PAGE
Lloh12:
	add	x2, x2, l_.str.3@PAGEOFF
	add	x0, sp, #1, lsl #12             ; =4096
	add	x0, x0, #24
	mov	w1, #256
	mov	x3, x19
	bl	_snprintf
Lloh13:
	adrp	x2, l_.str.4@PAGE
Lloh14:
	add	x2, x2, l_.str.4@PAGEOFF
	add	x0, sp, #3096
	mov	w1, #1024
	mov	x3, x21
	bl	_snprintf
	add	x0, sp, #3096
	bl	_Mkdir
	cbz	w0, LBB0_12
; %bb.7:
Lloh15:
	adrp	x1, l_.str.5@PAGE
Lloh16:
	add	x1, x1, l_.str.5@PAGEOFF
	add	x0, sp, #3096
	bl	_strcat
	add	x0, sp, #3096
	bl	_Mkdir
	cbz	w0, LBB0_12
; %bb.8:
Lloh17:
	adrp	x1, l_.str.6@PAGE
Lloh18:
	add	x1, x1, l_.str.6@PAGEOFF
	add	x0, sp, #3096
	bl	_strcat
	add	x0, sp, #3096
	bl	_Mkdir
	cbz	w0, LBB0_12
; %bb.9:
	add	x0, sp, #3096
	add	x1, sp, #1, lsl #12             ; =4096
	add	x1, x1, #24
	bl	_strcat
Lloh19:
	adrp	x1, l_.str.7@PAGE
Lloh20:
	add	x1, x1, l_.str.7@PAGEOFF
	add	x0, sp, #3096
	bl	_fopen
	cbz	x0, LBB0_12
; %bb.10:
	mov	x21, x0
	add	x0, sp, #1048
	mov	w1, #1
	mov	x2, x20
	mov	x3, x21
	bl	_fwrite
	mov	x0, x21
	bl	_fclose
	str	x19, [sp]
Lloh21:
	adrp	x2, l_.str.8@PAGE
Lloh22:
	add	x2, x2, l_.str.8@PAGEOFF
	add	x0, sp, #1, lsl #12             ; =4096
	add	x0, x0, #280
	mov	w1, #1024
	mov	x3, x19
	bl	_snprintf
	add	x0, sp, #1, lsl #12             ; =4096
	add	x0, x0, #280
	bl	_system
	tbz	x0, #63, LBB0_12
; %bb.11:
Lloh23:
	adrp	x8, _stderr@GOTPAGE
Lloh24:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh25:
	ldr	w0, [x8]
Lloh26:
	adrp	x1, l_.str.9@PAGE
Lloh27:
	add	x1, x1, l_.str.9@PAGEOFF
	bl	_fprintf
LBB0_12:
	ldur	x8, [x29, #-40]
Lloh28:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh29:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh30:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_14
; %bb.13:
	add	sp, sp, #1, lsl #12             ; =4096
	add	sp, sp, #1312
	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
LBB0_14:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"HOME"

l_.str.1:                               ; @.str.1
	.asciz	"/proc/self/exe"

l_.str.2:                               ; @.str.2
	.asciz	"[Desktop Entry]\nName=Game %s\nExec=%s\nType=Application\nNoDisplay=true\nCategories=Discord;Games;\nMimeType=x-scheme-handler/discord-%s;\n"

l_.str.3:                               ; @.str.3
	.asciz	"/discord-%s.desktop"

l_.str.4:                               ; @.str.4
	.asciz	"%s/.local"

l_.str.5:                               ; @.str.5
	.asciz	"/share"

l_.str.6:                               ; @.str.6
	.asciz	"/applications"

l_.str.7:                               ; @.str.7
	.asciz	"w"

l_.str.8:                               ; @.str.8
	.asciz	"xdg-mime default discord-%s.desktop x-scheme-handler/discord-%s"

	.comm	_stderr,4,2                     ; @stderr
l_.str.9:                               ; @.str.9
	.asciz	"Failed to register mime handler\n"

.subsections_via_symbols
