	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_read_stream                    ## -- Begin function read_stream
	.p2align	4, 0x90
_read_stream:                           ## @read_stream
	.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
	movq	%rsi, %r14
	movq	%rdi, %r15
	movq	%rsi, %rdi
	callq	_get_addressed_line_node
	movq	%rax, %r12
	movq	_newline_added@GOTPCREL(%rip), %rdx
	movl	(%rdx), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_isbinary@GOTPCREL(%rip), %rcx
	movl	(%rcx), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	_addr_last@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	$0, (%rdx)
	movl	$0, (%rcx)
	movq	_current_addr@GOTPCREL(%rip), %rax
	movq	%r14, (%rax)
	movq	%r15, %rdi
	callq	_get_stream_line
	movl	%eax, %ebx
	testl	%eax, %eax
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	jle	LBB0_1
## %bb.2:
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%r12, (%r14)
LBB0_8:                                 ##   in Loop: Header=BB0_3 Depth=1
	xorl	%eax, %eax
	callq	_SPL0
	movl	%ebx, %eax
	addq	%rax, %r13
	movq	%r15, %rdi
	callq	_get_stream_line
	movl	%eax, %ebx
	testl	%eax, %eax
	jle	LBB0_9
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_SPL1
	movq	_sbuf@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_put_sbuf_line
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	(%r12), %r12
	testq	%r14, %r14
	jne	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_UADD@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_current_addr@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	%rdx, %rsi
	callq	_push_undo_stack
	movq	%rax, %r14
	testq	%rax, %rax
	jne	LBB0_8
LBB0_4:
	xorl	%eax, %eax
	callq	_SPL0
	jmp	LBB0_10
LBB0_1:
	xorl	%r13d, %r13d
LBB0_9:
	testl	%ebx, %ebx
	js	LBB0_10
## %bb.11:
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	cmpq	%r14, %rbx
	movl	-48(%rbp), %r12d                ## 4-byte Reload
	jne	LBB0_16
## %bb.12:
	testq	%r13, %r13
	je	LBB0_16
## %bb.13:
	testl	%r12d, %r12d
	je	LBB0_16
## %bb.14:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_16
## %bb.15:
	leaq	L_.str(%rip), %rdi
	movq	_isbinary@GOTPCREL(%rip), %r15
	jmp	LBB0_19
LBB0_10:
	movq	_ERR@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	jmp	LBB0_21
LBB0_16:
	movq	_newline_added@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	movq	_isbinary@GOTPCREL(%rip), %r15
	je	LBB0_20
## %bb.17:
	leaq	L_.str.1(%rip), %rdi
	cmpq	%r14, %rbx
	jne	LBB0_19
## %bb.18:
	movl	(%r15), %eax
	orl	%r12d, %eax
	jne	LBB0_20
LBB0_19:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_fputs
LBB0_20:
	cmpq	%r14, %rbx
	sete	%al
	movl	(%r15), %ecx
	testl	%ecx, %ecx
	sete	%dl
	movq	_newline_added@GOTPCREL(%rip), %r8
	movl	(%r8), %esi
	testl	%esi, %esi
	movq	%rbx, %rdi
	sete	%bl
	orb	%dl, %bl
	orb	%al, %bl
	xorb	$1, %bl
	movzbl	%bl, %eax
	addq	%rax, %r13
	movl	$1, %eax
	cmovnel	%esi, %eax
	cmpq	%r14, %rdi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	cmovel	%eax, %edx
	movl	%edx, (%r8)
	orl	%ecx, %r12d
	movl	%r12d, (%r15)
LBB0_21:
	movq	%r13, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_newline_added,4,2              ## @newline_added
	.comm	_isbinary,4,2                   ## @isbinary
	.comm	_addr_last,8,3                  ## @addr_last
	.comm	_current_addr,8,3               ## @current_addr
	.comm	_sbuf,4,2                       ## @sbuf
	.comm	_ERR,8,3                        ## @ERR
	.comm	_UADD,4,2                       ## @UADD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"newline inserted\n"

	.comm	_stderr,4,2                     ## @stderr
L_.str.1:                               ## @.str.1
	.asciz	"newline appended\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_read_stream                    ; -- Begin function read_stream
	.p2align	2
_read_stream:                           ; @read_stream
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x19, x1
	mov	x20, x0
	mov	x0, x1
	bl	_get_addressed_line_node
	mov	x21, x0
Lloh0:
	adrp	x9, _newline_added@GOTPAGE
Lloh1:
	ldr	x9, [x9, _newline_added@GOTPAGEOFF]
	ldr	w8, [x9]
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
Lloh2:
	adrp	x10, _isbinary@GOTPAGE
Lloh3:
	ldr	x10, [x10, _isbinary@GOTPAGEOFF]
	ldr	w8, [x10]
	str	w8, [sp, #8]                    ; 4-byte Folded Spill
Lloh4:
	adrp	x8, _addr_last@GOTPAGE
Lloh5:
	ldr	x8, [x8, _addr_last@GOTPAGEOFF]
Lloh6:
	ldr	x28, [x8]
	str	wzr, [x9]
	str	wzr, [x10]
Lloh7:
	adrp	x27, _current_addr@GOTPAGE
Lloh8:
	ldr	x27, [x27, _current_addr@GOTPAGEOFF]
	str	x19, [x27]
	mov	x0, x20
	bl	_get_stream_line
	mov	x22, x0
	cmp	w0, #1
	b.lt	LBB0_8
; %bb.1:
	mov	x23, #0
	mov	x26, #0
Lloh9:
	adrp	x25, _sbuf@GOTPAGE
Lloh10:
	ldr	x25, [x25, _sbuf@GOTPAGEOFF]
Lloh11:
	adrp	x24, _UADD@GOTPAGE
Lloh12:
	ldr	x24, [x24, _UADD@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	str	x21, [x23]
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	bl	_SPL0
	add	x26, x26, w22, uxtw
	mov	x0, x20
	bl	_get_stream_line
	mov	x22, x0
	cmp	w0, #0
	b.le	LBB0_9
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	bl	_SPL1
	ldr	w0, [x25]
	bl	_put_sbuf_line
	cbz	x0, LBB0_7
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x21, [x21]
	cbnz	x23, LBB0_2
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w0, [x24]
	ldr	x1, [x27]
	mov	x2, x1
	bl	_push_undo_stack
	mov	x23, x0
	cbnz	x0, LBB0_3
LBB0_7:
	bl	_SPL0
	b	LBB0_15
LBB0_8:
	mov	x26, #0
LBB0_9:
	tbnz	w22, #31, LBB0_15
; %bb.10:
	cmp	x28, x19
	ccmp	x26, #0, #4, eq
	ldp	w23, w22, [sp, #8]              ; 8-byte Folded Reload
	ccmp	w23, #0, #4, ne
	ccmp	w22, #0, #4, ne
	b.ne	LBB0_16
; %bb.11:
Lloh13:
	adrp	x20, _newline_added@GOTPAGE
Lloh14:
	ldr	x20, [x20, _newline_added@GOTPAGEOFF]
	ldr	w8, [x20]
Lloh15:
	adrp	x21, _isbinary@GOTPAGE
Lloh16:
	ldr	x21, [x21, _isbinary@GOTPAGEOFF]
	cbz	w8, LBB0_18
; %bb.12:
	cmp	x28, x19
	b.ne	LBB0_14
; %bb.13:
	ldr	w8, [x21]
	orr	w8, w8, w23
	cbnz	w8, LBB0_18
LBB0_14:
Lloh17:
	adrp	x0, l_.str.1@PAGE
Lloh18:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_17
LBB0_15:
Lloh19:
	adrp	x8, _ERR@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ERR@GOTPAGEOFF]
Lloh21:
	ldr	x0, [x8]
	b	LBB0_19
LBB0_16:
Lloh22:
	adrp	x0, l_.str@PAGE
Lloh23:
	add	x0, x0, l_.str@PAGEOFF
Lloh24:
	adrp	x20, _newline_added@GOTPAGE
Lloh25:
	ldr	x20, [x20, _newline_added@GOTPAGEOFF]
Lloh26:
	adrp	x21, _isbinary@GOTPAGE
Lloh27:
	ldr	x21, [x21, _isbinary@GOTPAGEOFF]
LBB0_17:
Lloh28:
	adrp	x8, _stderr@GOTPAGE
Lloh29:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
	bl	_fputs
LBB0_18:
	cmp	x28, x19
	cset	w8, ne
	ldr	w9, [x21]
	cmp	w9, #0
	ldr	w10, [x20]
	ccmp	w10, #0, #4, ne
	cset	w11, ne
	and	w8, w11, w8
	adds	x0, x26, x8
	csinc	w8, w10, wzr, ne
	cmp	x28, x19
	csel	w8, w8, w22, eq
	str	w8, [x20]
	orr	w8, w9, w23
	str	w8, [x21]
LBB0_19:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_newline_added,4,2              ; @newline_added
	.comm	_isbinary,4,2                   ; @isbinary
	.comm	_addr_last,8,3                  ; @addr_last
	.comm	_current_addr,8,3               ; @current_addr
	.comm	_sbuf,4,2                       ; @sbuf
	.comm	_ERR,8,3                        ; @ERR
	.comm	_UADD,4,2                       ; @UADD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"newline inserted\n"

	.comm	_stderr,4,2                     ; @stderr
l_.str.1:                               ; @.str.1
	.asciz	"newline appended\n"

.subsections_via_symbols
