	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_knet_read                      ## -- Begin function knet_read
	.p2align	4, 0x90
_knet_read:                             ## @knet_read
	.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, -48(%rbp)                 ## 8-byte Spill
	cmpl	$-1, (%rdi)
	je	LBB0_1
## %bb.2:
	movq	%rdx, %r13
	movq	%rdi, %r14
	movq	8(%rdi), %rax
	movq	_KNF_TYPE_FTP@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.3:
	cmpq	$0, 16(%r14)
	jne	LBB0_10
## %bb.4:
	cmpl	$0, 28(%r14)
	jne	LBB0_6
## %bb.5:
	movq	%r14, %rdi
	callq	_kftp_reconnect
LBB0_6:
	movq	%r14, %rdi
	callq	_kftp_connect_file
	jmp	LBB0_10
LBB0_1:
	xorl	%ecx, %ecx
	jmp	LBB0_23
LBB0_7:
	movq	_KNF_TYPE_HTTP@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_10
## %bb.8:
	cmpq	$0, 16(%r14)
	jne	LBB0_10
## %bb.9:
	movq	%r14, %rdi
	callq	_khttp_connect_file
LBB0_10:
	movq	8(%r14), %rax
	movq	_KNF_TYPE_LOCAL@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_21
## %bb.11:
	xorl	%ecx, %ecx
	testq	%r13, %r13
	je	LBB0_22
## %bb.12:
	movq	_EINTR@GOTPCREL(%rip), %r15
	movq	_errno@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_13:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_14 Depth 2
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	leaq	(%rax,%rcx), %rbx
	.p2align	4, 0x90
LBB0_14:                                ##   Parent Loop BB0_13 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r14), %edi
	movq	%rbx, %rsi
	movq	%r13, %rdx
	callq	_read
	testq	%rax, %rax
	jns	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=2
	movq	(%r12), %rcx
	cmpq	%rcx, (%r15)
	je	LBB0_14
LBB0_16:                                ##   in Loop: Header=BB0_13 Depth=1
	testq	%rax, %rax
	js	LBB0_17
## %bb.18:                              ##   in Loop: Header=BB0_13 Depth=1
	je	LBB0_19
## %bb.20:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	addq	%rax, %rcx
	subq	%rax, %r13
	jne	LBB0_13
	jmp	LBB0_22
LBB0_21:
	movl	(%r14), %edi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	%r13, %rdx
	callq	_my_netread
	movq	%rax, %rcx
LBB0_22:
	addl	%ecx, 24(%r14)
LBB0_23:
	movq	%rcx, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	movq	$-1, %rcx
	jmp	LBB0_23
LBB0_19:
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	jmp	LBB0_22
	.cfi_endproc
                                        ## -- End function
	.comm	_KNF_TYPE_FTP,8,3               ## @KNF_TYPE_FTP
	.comm	_KNF_TYPE_HTTP,8,3              ## @KNF_TYPE_HTTP
	.comm	_KNF_TYPE_LOCAL,8,3             ## @KNF_TYPE_LOCAL
	.comm	_EINTR,8,3                      ## @EINTR
	.comm	_errno,8,3                      ## @errno
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_knet_read                      ; -- Begin function knet_read
	.p2align	2
_knet_read:                             ; @knet_read
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	ldr	w8, [x0]
	cmn	w8, #1
	b.eq	LBB0_6
; %bb.1:
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	ldr	x8, [x0, #8]
Lloh0:
	adrp	x9, _KNF_TYPE_FTP@GOTPAGE
Lloh1:
	ldr	x9, [x9, _KNF_TYPE_FTP@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.2:
	ldr	x8, [x19, #16]
	cbnz	x8, LBB0_10
; %bb.3:
	ldr	w8, [x19, #28]
	cbnz	w8, LBB0_5
; %bb.4:
	mov	x0, x19
	bl	_kftp_reconnect
LBB0_5:
	mov	x0, x19
	bl	_kftp_connect_file
	b	LBB0_10
LBB0_6:
	mov	x22, #0
	b	LBB0_21
LBB0_7:
Lloh3:
	adrp	x9, _KNF_TYPE_HTTP@GOTPAGE
Lloh4:
	ldr	x9, [x9, _KNF_TYPE_HTTP@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_10
; %bb.8:
	ldr	x8, [x19, #16]
	cbnz	x8, LBB0_10
; %bb.9:
	mov	x0, x19
	bl	_khttp_connect_file
LBB0_10:
	ldr	x8, [x19, #8]
Lloh6:
	adrp	x9, _KNF_TYPE_LOCAL@GOTPAGE
Lloh7:
	ldr	x9, [x9, _KNF_TYPE_LOCAL@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_19
; %bb.11:
	mov	x22, #0
	cbz	x20, LBB0_20
; %bb.12:
Lloh9:
	adrp	x24, _EINTR@GOTPAGE
Lloh10:
	ldr	x24, [x24, _EINTR@GOTPAGEOFF]
Lloh11:
	adrp	x25, _errno@GOTPAGE
Lloh12:
	ldr	x25, [x25, _errno@GOTPAGEOFF]
LBB0_13:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_14 Depth 2
	add	x23, x21, x22
LBB0_14:                                ;   Parent Loop BB0_13 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w0, [x19]
	mov	x1, x23
	mov	x2, x20
	bl	_read
	tbz	x0, #63, LBB0_16
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=2
	ldr	x8, [x24]
	ldr	x9, [x25]
	cmp	x8, x9
	b.eq	LBB0_14
LBB0_16:                                ;   in Loop: Header=BB0_13 Depth=1
	tbnz	x0, #63, LBB0_22
; %bb.17:                               ;   in Loop: Header=BB0_13 Depth=1
	cbz	x0, LBB0_20
; %bb.18:                               ;   in Loop: Header=BB0_13 Depth=1
	add	x22, x0, x22
	subs	x20, x20, x0
	b.ne	LBB0_13
	b	LBB0_20
LBB0_19:
	ldr	w0, [x19]
	mov	x1, x21
	mov	x2, x20
	bl	_my_netread
	mov	x22, x0
LBB0_20:
	ldr	w8, [x19, #24]
	add	w8, w8, w22
	str	w8, [x19, #24]
LBB0_21:
	mov	x0, x22
	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
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_22:
	mov	x22, #-1
	b	LBB0_21
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_KNF_TYPE_FTP,8,3               ; @KNF_TYPE_FTP
	.comm	_KNF_TYPE_HTTP,8,3              ; @KNF_TYPE_HTTP
	.comm	_KNF_TYPE_LOCAL,8,3             ; @KNF_TYPE_LOCAL
	.comm	_EINTR,8,3                      ; @EINTR
	.comm	_errno,8,3                      ; @errno
.subsections_via_symbols
