	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_CL_SaveConsoleHistory          ## -- Begin function CL_SaveConsoleHistory
	.p2align	4, 0x90
_CL_SaveConsoleHistory:                 ## @CL_SaveConsoleHistory
	.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
	movq	_consoleSaveBuffer@GOTPCREL(%rip), %r14
	movq	(%r14), %rax
	movb	$0, (%rax)
	movq	_nextHistoryLine@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leal	-1(%rcx), %eax
	movq	_COMMAND_HISTORY@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	cltd
	idivl	%esi
	movl	%edx, %ebx
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_1 Depth=1
	leal	(%rbx,%rsi), %eax
	decl	%eax
	cltd
	idivl	%esi
	leal	-1(%rcx), %eax
	movl	%edx, %ebx
	cltd
	idivl	%esi
	cmpl	%edx, %ebx
	je	LBB0_5
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	_historyEditLines@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%ebx, %r15
	shlq	$4, %r15
	movq	(%rax,%r15), %rdi
	cmpb	$0, (%rdi)
	je	LBB0_4
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	callq	_strlen
	movl	%eax, %r13d
	movq	(%r14), %rdi
	callq	_strlen
	movq	%r14, %r12
	movl	%eax, %r14d
	leaq	L_.str(%rip), %rdi
	callq	_strlen
	addl	%r13d, %r14d
	addl	%eax, %r14d
	movq	_MAX_CONSOLE_SAVE_BUFFER@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	cmpl	%ebx, %r14d
	movq	%r12, %r14
	jge	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	(%r12), %r14
	movq	_historyEditLines@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	12(%rax,%r15), %esi
	movl	8(%rax,%r15), %edx
	movq	(%rax,%r15), %r8
	leaq	L_.str.1(%rip), %rdi
	movl	%r13d, %ecx
	callq	_va
	movq	%r14, %rdi
	movq	%r12, %r14
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_Q_strcat
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	_COMMAND_HISTORY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_nextHistoryLine@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	jmp	LBB0_4
LBB0_5:
	movq	(%r14), %rdi
	callq	_strlen
	movq	_consoleSaveBufferSize@GOTPCREL(%rip), %r15
	movl	%eax, (%r15)
	movq	%r14, %r12
	movq	_CONSOLE_HISTORY_FILE@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	callq	_FS_FOpenFileWrite
	testl	%eax, %eax
	je	LBB0_9
## %bb.6:
	movl	%eax, %ebx
	movq	(%r12), %rdi
	movl	(%r15), %esi
	movl	%eax, %edx
	callq	_FS_Write
	cmpl	(%r15), %eax
	jge	LBB0_8
## %bb.7:
	movl	(%r14), %esi
	leaq	L_.str.2(%rip), %rdi
	callq	_Com_Printf
LBB0_8:
	movl	%ebx, %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_FS_FCloseFile                  ## TAILCALL
LBB0_9:
	movl	(%r14), %esi
	leaq	L_.str.2(%rip), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_Com_Printf                     ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_consoleSaveBuffer,8,3          ## @consoleSaveBuffer
	.comm	_nextHistoryLine,4,2            ## @nextHistoryLine
	.comm	_COMMAND_HISTORY,4,2            ## @COMMAND_HISTORY
	.comm	_historyEditLines,8,3           ## @historyEditLines
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"999 999 999  "

	.comm	_MAX_CONSOLE_SAVE_BUFFER,4,2    ## @MAX_CONSOLE_SAVE_BUFFER
L_.str.1:                               ## @.str.1
	.asciz	"%d %d %d %s "

	.comm	_consoleSaveBufferSize,4,2      ## @consoleSaveBufferSize
	.comm	_CONSOLE_HISTORY_FILE,4,2       ## @CONSOLE_HISTORY_FILE
L_.str.2:                               ## @.str.2
	.asciz	"Couldn't write %s.\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_CL_SaveConsoleHistory          ; -- Begin function CL_SaveConsoleHistory
	.p2align	2
_CL_SaveConsoleHistory:                 ; @CL_SaveConsoleHistory
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
Lloh0:
	adrp	x24, _consoleSaveBuffer@GOTPAGE
Lloh1:
	ldr	x24, [x24, _consoleSaveBuffer@GOTPAGEOFF]
	ldr	x8, [x24]
	strb	wzr, [x8]
Lloh2:
	adrp	x8, _nextHistoryLine@GOTPAGE
Lloh3:
	ldr	x8, [x8, _nextHistoryLine@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x26, _COMMAND_HISTORY@GOTPAGE
Lloh6:
	ldr	x26, [x26, _COMMAND_HISTORY@GOTPAGEOFF]
	sub	w10, w8, #1
	ldr	w9, [x26]
	sdiv	w11, w10, w9
	msub	w10, w11, w9, w10
Lloh7:
	adrp	x27, _historyEditLines@GOTPAGE
Lloh8:
	ldr	x27, [x27, _historyEditLines@GOTPAGEOFF]
Lloh9:
	adrp	x19, l_.str@PAGE
Lloh10:
	add	x19, x19, l_.str@PAGEOFF
Lloh11:
	adrp	x28, _MAX_CONSOLE_SAVE_BUFFER@GOTPAGE
Lloh12:
	ldr	x28, [x28, _MAX_CONSOLE_SAVE_BUFFER@GOTPAGEOFF]
Lloh13:
	adrp	x20, l_.str.1@PAGE
Lloh14:
	add	x20, x20, l_.str.1@PAGEOFF
	b	LBB0_2
LBB0_1:                                 ;   in Loop: Header=BB0_2 Depth=1
	add	w10, w25, w9
	sub	w10, w10, #1
	sdiv	w11, w10, w9
	msub	w10, w11, w9, w10
	sub	w11, w8, #1
	sdiv	w12, w11, w9
	msub	w11, w12, w9, w11
	cmp	w10, w11
	b.eq	LBB0_5
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x27]
	sxtw	x25, w10
	sbfiz	x10, x10, #4, #32
	ldr	x0, [x11, x10]
	ldrb	w10, [x0]
	cbz	w10, LBB0_1
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	bl	_strlen
	mov	x21, x0
	ldr	x0, [x24]
	bl	_strlen
	mov	x22, x0
	mov	x0, x19
	bl	_strlen
	add	w8, w22, w21
	add	w8, w8, w0
	ldr	w22, [x28]
	cmp	w8, w22
	b.ge	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x23, [x24]
	ldr	x8, [x27]
	add	x8, x8, x25, lsl #4
	ldp	w2, w1, [x8, #8]
	ldr	x4, [x8]
	mov	x0, x20
	mov	x3, x21
	bl	_va
	mov	x2, x0
	mov	x0, x23
	mov	x1, x22
	bl	_Q_strcat
	ldr	w9, [x26]
Lloh15:
	adrp	x8, _nextHistoryLine@GOTPAGE
Lloh16:
	ldr	x8, [x8, _nextHistoryLine@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	b	LBB0_1
LBB0_5:
	ldr	x0, [x24]
	bl	_strlen
Lloh18:
	adrp	x21, _consoleSaveBufferSize@GOTPAGE
Lloh19:
	ldr	x21, [x21, _consoleSaveBufferSize@GOTPAGEOFF]
	str	w0, [x21]
Lloh20:
	adrp	x20, _CONSOLE_HISTORY_FILE@GOTPAGE
Lloh21:
	ldr	x20, [x20, _CONSOLE_HISTORY_FILE@GOTPAGEOFF]
	ldr	w0, [x20]
	bl	_FS_FOpenFileWrite
	cbz	w0, LBB0_9
; %bb.6:
	mov	x19, x0
	ldr	x0, [x24]
	ldr	w1, [x21]
	mov	x2, x19
	bl	_FS_Write
	ldr	w8, [x21]
	cmp	w0, w8
	b.ge	LBB0_8
; %bb.7:
	ldr	w1, [x20]
Lloh22:
	adrp	x0, l_.str.2@PAGE
Lloh23:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_Com_Printf
LBB0_8:
	mov	x0, x19
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	_FS_FCloseFile
LBB0_9:
	ldr	w1, [x20]
Lloh24:
	adrp	x0, l_.str.2@PAGE
Lloh25:
	add	x0, x0, l_.str.2@PAGEOFF
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	_Com_Printf
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_consoleSaveBuffer,8,3          ; @consoleSaveBuffer
	.comm	_nextHistoryLine,4,2            ; @nextHistoryLine
	.comm	_COMMAND_HISTORY,4,2            ; @COMMAND_HISTORY
	.comm	_historyEditLines,8,3           ; @historyEditLines
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"999 999 999  "

	.comm	_MAX_CONSOLE_SAVE_BUFFER,4,2    ; @MAX_CONSOLE_SAVE_BUFFER
l_.str.1:                               ; @.str.1
	.asciz	"%d %d %d %s "

	.comm	_consoleSaveBufferSize,4,2      ; @consoleSaveBufferSize
	.comm	_CONSOLE_HISTORY_FILE,4,2       ; @CONSOLE_HISTORY_FILE
l_.str.2:                               ; @.str.2
	.asciz	"Couldn't write %s.\n"

.subsections_via_symbols
