	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_write_history                  ## -- Begin function write_history
	.p2align	4, 0x90
_write_history:                         ## @write_history
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	movq	_h@GOTPCREL(%rip), %r14
	cmpq	$0, (%r14)
	je	LBB0_2
## %bb.1:
	movq	_e@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_2
## %bb.3:
	testq	%rbx, %rbx
	jne	LBB0_6
	jmp	LBB0_4
LBB0_2:
	xorl	%eax, %eax
	callq	_rl_initialize
	testq	%rbx, %rbx
	jne	LBB0_6
LBB0_4:
	xorl	%eax, %eax
	callq	__default_history_file
	movq	%rax, %rbx
	testq	%rax, %rax
	je	LBB0_5
LBB0_6:
	movq	(%r14), %rdi
	movq	_H_SAVE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-20(%rbp), %rsi
	movq	%rbx, %rcx
	callq	_history
	movq	_errno@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	testl	%edx, %edx
	jne	LBB0_8
## %bb.7:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
LBB0_8:
	xorl	%ecx, %ecx
	cmpl	$-1, %eax
	cmovel	%edx, %ecx
LBB0_9:
	movl	%ecx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_5:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_h,8,3                          ## @h
	.comm	_e,8,3                          ## @e
	.comm	_errno,4,2                      ## @errno
	.comm	_H_SAVE,4,2                     ## @H_SAVE
	.comm	_EINVAL,4,2                     ## @EINVAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_write_history                  ; -- Begin function write_history
	.p2align	2
_write_history:                         ; @write_history
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x19, x0
Lloh0:
	adrp	x20, _h@GOTPAGE
Lloh1:
	ldr	x20, [x20, _h@GOTPAGEOFF]
	ldr	x8, [x20]
Lloh2:
	adrp	x9, _e@GOTPAGE
Lloh3:
	ldr	x9, [x9, _e@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, #0
	ccmp	x9, #0, #4, ne
	b.ne	LBB0_2
; %bb.1:
	bl	_rl_initialize
LBB0_2:
	cbnz	x19, LBB0_4
; %bb.3:
	bl	__default_history_file
	mov	x19, x0
	cbz	x0, LBB0_6
LBB0_4:
	ldr	x0, [x20]
Lloh5:
	adrp	x8, _H_SAVE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _H_SAVE@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	add	x1, sp, #12
	mov	x3, x19
	bl	_history
Lloh8:
	adrp	x8, _errno@GOTPAGE
Lloh9:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh10:
	adrp	x9, _EINVAL@GOTPAGE
Lloh11:
	ldr	x9, [x9, _EINVAL@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
Lloh13:
	ldr	w9, [x9]
	cmp	w8, #0
	csel	w8, w9, w8, eq
	cmn	w0, #1
	csel	w0, w8, wzr, eq
LBB0_5:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
LBB0_6:
Lloh14:
	adrp	x8, _errno@GOTPAGE
Lloh15:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh12
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_h,8,3                          ; @h
	.comm	_e,8,3                          ; @e
	.comm	_errno,4,2                      ; @errno
	.comm	_H_SAVE,4,2                     ; @H_SAVE
	.comm	_EINVAL,4,2                     ; @EINVAL
.subsections_via_symbols
