	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_khttp_connect_file             ## -- Begin function khttp_connect_file
	.p2align	4, 0x90
_khttp_connect_file:                    ## @khttp_connect_file
	.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	%rdi, %r14
	movl	(%rdi), %edi
	cmpl	$-1, %edi
	je	LBB0_2
## %bb.1:
	callq	_netclose
LBB0_2:
	movl	36(%r14), %esi
	movl	40(%r14), %edi
	callq	_socket_connect
	movl	%eax, (%r14)
	movl	$65536, %edi                    ## imm = 0x10000
	movl	$1, %esi
	callq	_calloc
	movq	%rax, %r13
	movq	8(%r14), %rdx
	movq	16(%r14), %rcx
	leaq	L_.str(%rip), %rsi
	movq	%rax, %rdi
	xorl	%eax, %eax
	callq	_sprintf
	movq	%rax, %r15
	movslq	%r15d, %rdi
	addq	%r13, %rdi
	movq	24(%r14), %rdx
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_sprintf
	addq	%r15, %rax
	movslq	%eax, %r15
	leaq	(%r15,%r13), %rdi
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_sprintf
	addl	%eax, %r15d
	movl	(%r14), %edi
	movq	%r13, %rsi
	movl	%r15d, %edx
	callq	_netwrite
	movl	(%r14), %edi
	movq	%r13, %rsi
	movl	$1, %edx
	callq	_netread
	testq	%rax, %rax
	je	LBB0_18
## %bb.3:
	xorl	%ebx, %ebx
	leaq	L_.str.3(%rip), %r15
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_4 Depth=1
	movl	(%r14), %edi
	leaq	(%rbx,%r13), %rsi
	incq	%rsi
	incq	%rbx
	movl	$1, %edx
	callq	_netread
	testq	%rax, %rax
	je	LBB0_8
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	cmpb	$10, (%r13,%rbx)
	jne	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	cmpq	$3, %rbx
	jb	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	leaq	(%rbx,%r13), %rdi
	addq	$-3, %rdi
	movq	%r15, %rsi
	movl	$4, %edx
	callq	_strncmp
	testq	%rax, %rax
	jne	LBB0_7
LBB0_8:
	leaq	(%rbx,%r13), %rax
	movb	$0, (%rax)
	cmpl	$13, %ebx
	jbe	LBB0_9
## %bb.10:
	movq	%r13, %rdi
	addq	$8, %rdi
	leaq	-48(%rbp), %rsi
	xorl	%r15d, %r15d
	xorl	%edx, %edx
	callq	_strtol
	cmpl	$206, %eax
	je	LBB0_16
## %bb.11:
	movl	%eax, %r12d
	cmpl	$200, %eax
	jne	LBB0_19
## %bb.12:
	movq	24(%r14), %rdx
	testq	%rdx, %rdx
	jle	LBB0_16
## %bb.13:
	testl	%edx, %edx
	je	LBB0_16
## %bb.14:
	movl	$65536, %r12d                   ## imm = 0x10000
	movq	%rdx, %rbx
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	cmpl	$65536, %edx                    ## imm = 0x10000
	cmovgel	%r12d, %edx
	movl	(%r14), %edi
	movq	%r13, %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_my_netread
	movslq	%ebx, %rdx
	subq	%rax, %rdx
	movq	%rdx, %rbx
	testl	%edx, %edx
	jne	LBB0_15
LBB0_16:
	movq	%r13, %rdi
	callq	_free
	movl	$1, 32(%r14)
	jmp	LBB0_17
LBB0_18:
	movb	$0, (%r13)
	jmp	LBB0_9
LBB0_19:
	movq	%r13, %rdi
	callq	_free
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.4(%rip), %rsi
	movl	%r12d, %edx
	callq	_fprintf
LBB0_9:
	movl	(%r14), %edi
	callq	_netclose
	movl	$-1, (%r14)
	movl	$-1, %r15d
LBB0_17:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"GET %s HTTP/1.0\r\nHost: %s\r\n"

L_.str.1:                               ## @.str.1
	.asciz	"Range: bytes=%lld-\r\n"

L_.str.2:                               ## @.str.2
	.asciz	"\r\n"

L_.str.3:                               ## @.str.3
	.asciz	"\r\n\r\n"

	.comm	_stderr,4,2                     ## @stderr
L_.str.4:                               ## @.str.4
	.asciz	"[khttp_connect_file] fail to open file (HTTP code: %d).\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_khttp_connect_file             ; -- Begin function khttp_connect_file
	.p2align	2
_khttp_connect_file:                    ; @khttp_connect_file
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x19, x0
	ldr	w0, [x0]
	cmn	w0, #1
	b.eq	LBB0_2
; %bb.1:
	bl	_netclose
LBB0_2:
	ldp	w1, w0, [x19, #36]
	bl	_socket_connect
	str	w0, [x19]
	mov	w0, #65536
	mov	w1, #1
	bl	_calloc
	mov	x20, x0
	ldp	x8, x9, [x19, #8]
	stp	x8, x9, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_sprintf
	mov	x21, x0
	add	x0, x20, w21, sxtw
	ldr	x8, [x19, #24]
	str	x8, [sp]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_sprintf
	add	x21, x0, x21
	add	x0, x20, w21, sxtw
Lloh4:
	adrp	x1, l_.str.2@PAGE
Lloh5:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_sprintf
	add	w2, w21, w0
	ldr	w0, [x19]
	mov	x1, x20
	bl	_netwrite
	ldr	w0, [x19]
	mov	x1, x20
	mov	w2, #1
	bl	_netread
	cbz	x0, LBB0_16
; %bb.3:
	mov	x22, #0
Lloh6:
	adrp	x21, l_.str.3@PAGE
Lloh7:
	add	x21, x21, l_.str.3@PAGEOFF
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x23, x22, #1
	ldr	w0, [x19]
	add	x8, x20, x22
	add	x1, x8, #1
	mov	w2, #1
	bl	_netread
	mov	x22, x23
	cbz	x0, LBB0_8
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldrb	w8, [x20, x22]
	cmp	w8, #10
	ccmp	x22, #3, #0, eq
	b.lo	LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x8, x20, x22
	sub	x0, x8, #3
	mov	x1, x21
	mov	w2, #4
	bl	_strncmp
	cbnz	x0, LBB0_4
; %bb.7:
	mov	x23, x22
LBB0_8:
	strb	wzr, [x20, x23]
	cmp	w23, #13
	b.ls	LBB0_18
; %bb.9:
	add	x0, x20, #8
	add	x1, sp, #24
	mov	w2, #0
	bl	_strtol
	cmp	w0, #206
	b.eq	LBB0_15
; %bb.10:
	mov	x21, x0
	cmp	w0, #200
	b.ne	LBB0_17
; %bb.11:
	ldr	x21, [x19, #24]
	cmp	x21, #1
	b.lt	LBB0_15
; %bb.12:
	cbz	w21, LBB0_15
; %bb.13:
	mov	w22, #65536
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	cmp	w21, #16, lsl #12               ; =65536
	csel	w2, w21, w22, lt
	ldr	w0, [x19]
	mov	x1, x20
	bl	_my_netread
	sxtw	x8, w21
	sub	x21, x8, x0
	cbnz	w21, LBB0_14
LBB0_15:
	mov	x0, x20
	bl	_free
	mov	w0, #0
	mov	w8, #1
	str	w8, [x19, #32]
	b	LBB0_19
LBB0_16:
	strb	wzr, [x20]
	b	LBB0_18
LBB0_17:
	mov	x0, x20
	bl	_free
Lloh8:
	adrp	x8, _stderr@GOTPAGE
Lloh9:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
Lloh11:
	adrp	x1, l_.str.4@PAGE
Lloh12:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x2, x21
	bl	_fprintf
LBB0_18:
	ldr	w0, [x19]
	bl	_netclose
	mov	w0, #-1
	str	w0, [x19]
LBB0_19:
	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
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"GET %s HTTP/1.0\r\nHost: %s\r\n"

l_.str.1:                               ; @.str.1
	.asciz	"Range: bytes=%lld-\r\n"

l_.str.2:                               ; @.str.2
	.asciz	"\r\n"

l_.str.3:                               ; @.str.3
	.asciz	"\r\n\r\n"

	.comm	_stderr,4,2                     ; @stderr
l_.str.4:                               ; @.str.4
	.asciz	"[khttp_connect_file] fail to open file (HTTP code: %d).\n"

.subsections_via_symbols
