	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fetch_to_fd
_fetch_to_fd:                           ## @fetch_to_fd
	.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
	movl	$10296, %eax                    ## imm = 0x2838
	callq	____chkstk_darwin
	subq	%rax, %rsp
	popq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %r14
	movq	%rsp, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_MAXHOSTNAMELEN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	$13, %eax
	movq	%rax, -10328(%rbp)              ## 8-byte Spill
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, -10320(%rbp)              ## 8-byte Spill
	cmpq	$0, _fetch_to_fd.mirror_type(%rip)
	je	LBB0_15
LBB0_1:
	movq	%r12, %rdi
	callq	_mkstemp
	cmpl	$-1, %eax
	je	LBB0_17
## %bb.2:
	movl	%eax, %r13d
	movq	%r14, %rdi
	callq	_fetchParseURL
	testq	%rax, %rax
	je	LBB0_18
## %bb.3:
	movq	%rax, %rbx
	movl	%r13d, -10292(%rbp)             ## 4-byte Spill
	movq	%r12, -10304(%rbp)              ## 8-byte Spill
	movq	%r15, -10312(%rbp)              ## 8-byte Spill
	movl	$3, %r15d
	xorl	%r13d, %r13d
	xorl	%r14d, %r14d
	cmpl	$3, %r15d
	jne	LBB0_9
	.p2align	4, 0x90
LBB0_6:
	movq	(%rbx), %rdi
	leaq	L_.str.3(%rip), %rsi
	callq	_strcmp
	testq	%rax, %rax
	je	LBB0_9
## %bb.7:
	movq	_fetch_to_fd.mirror_type(%rip), %rdi
	leaq	L_.str.4(%rip), %rsi
	callq	_strcasecmp
	testq	%rax, %rax
	jne	LBB0_9
## %bb.8:
	movq	(%rbx), %rcx
	movq	8(%rbx), %r8
	movq	-10320(%rbp), %r14              ## 8-byte Reload
	movq	%r14, %rdi
	movq	-10328(%rbp), %rsi              ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	leaq	L_.str.5(%rip), %rdx
	callq	_snprintf
	movq	%r14, %rdi
	callq	_dns_getsrvinfo
	movq	%rax, %r14
	movq	%rax, %r13
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_9 Depth=1
	movq	(%r14), %r14
	testq	%r14, %r14
	cmoveq	%r13, %r14
LBB0_5:                                 ##   in Loop: Header=BB0_9 Depth=1
	decl	%r15d
	cmpl	$3, %r15d
	je	LBB0_6
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	testq	%r13, %r13
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	8(%rbx), %rdi
	movl	12(%r14), %esi
	movl	$8, %edx
	callq	_strlcpy
	movl	8(%r14), %eax
	movl	%eax, 16(%rbx)
LBB0_11:                                ##   in Loop: Header=BB0_9 Depth=1
	movq	%rbx, %rdi
	leaq	-10336(%rbp), %rsi
	leaq	L_.str.6(%rip), %rdx
	callq	_fetchXGet
	movq	%rax, %r12
	testq	%rax, %rax
	jne	LBB0_19
## %bb.12:                              ##   in Loop: Header=BB0_9 Depth=1
	cmpl	$2, %r15d
	jl	LBB0_25
## %bb.13:                              ##   in Loop: Header=BB0_9 Depth=1
	testq	%r13, %r13
	jne	LBB0_4
## %bb.14:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	$1, %edi
	callq	_sleep
	jmp	LBB0_5
LBB0_15:
	movq	_MIRROR_TYPE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	_fetch_to_fd.mirror_type(%rip), %rsi
	callq	_config_string
	testq	%rax, %rax
	je	LBB0_1
## %bb.16:
	leaq	L_.str(%rip), %rdi
	callq	_warnx
	movl	$-1, %ebx
	jmp	LBB0_28
LBB0_17:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_warn
	movl	$-1, %ebx
	jmp	LBB0_28
LBB0_18:
	leaq	L_.str.2(%rip), %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	_warn
	movl	$-1, %ebx
	jmp	LBB0_28
LBB0_19:
	leaq	-10288(%rbp), %r15
	leaq	L_.str.7(%rip), %r14
	movl	-10292(%rbp), %r13d             ## 4-byte Reload
	.p2align	4, 0x90
LBB0_20:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	$1, %esi
	movl	$10240, %edx                    ## imm = 0x2800
	movq	%r12, %rcx
	callq	_fread
	testq	%rax, %rax
	jle	LBB0_22
## %bb.21:                              ##   in Loop: Header=BB0_20 Depth=1
	movq	%rax, %rbx
	movl	%r13d, %edi
	movq	%r15, %rsi
	movq	%rax, %rdx
	callq	_write
	cmpq	%rbx, %rax
	je	LBB0_20
	jmp	LBB0_24
LBB0_22:
	je	LBB0_30
## %bb.23:
	leaq	L_.str.8(%rip), %r14
LBB0_24:
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_warn
LBB0_25:
	movl	-10292(%rbp), %edi              ## 4-byte Reload
	callq	_close
	movq	-10304(%rbp), %rdi              ## 8-byte Reload
	callq	_unlink
	movl	$-1, %ebx
LBB0_26:
	testq	%r12, %r12
	movq	-10312(%rbp), %r15              ## 8-byte Reload
	je	LBB0_28
## %bb.27:
	movq	%r12, %rdi
	callq	_fclose
LBB0_28:
	movq	%r15, %rsp
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_32
## %bb.29:
	movl	%ebx, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_30:
	movq	%r12, %rdi
	callq	_ferror
	testq	%rax, %rax
	jne	LBB0_25
## %bb.31:
	movl	-10292(%rbp), %ebx              ## 4-byte Reload
	jmp	LBB0_26
LBB0_32:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAXHOSTNAMELEN,4,2             ## @MAXHOSTNAMELEN
.zerofill __DATA,__bss,_fetch_to_fd.mirror_type,8,3 ## @fetch_to_fd.mirror_type
	.comm	_MIRROR_TYPE,4,2                ## @MIRROR_TYPE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No MIRROR_TYPE defined"

L_.str.1:                               ## @.str.1
	.asciz	"mkstemp()"

L_.str.2:                               ## @.str.2
	.asciz	"fetchParseURL('%s')"

L_.str.3:                               ## @.str.3
	.asciz	"file"

L_.str.4:                               ## @.str.4
	.asciz	"srv"

L_.str.5:                               ## @.str.5
	.asciz	"_%s._tcp.%s"

L_.str.6:                               ## @.str.6
	.space	1

L_.str.7:                               ## @.str.7
	.asciz	"write()"

L_.str.8:                               ## @.str.8
	.asciz	"An error occurred while fetching pkg(8)"

	.no_dead_strip	_fetch_to_fd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fetch_to_fd
_fetch_to_fd:                           ; @fetch_to_fd
	.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
	mov	w9, #10288
Lloh0:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh1:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	sub	sp, sp, #2, lsl #12             ; =8192
	sub	sp, sp, #2096
	mov	x19, sp
	mov	x26, x1
	mov	x25, x0
	mov	x20, sp
Lloh2:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh3:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	stur	x8, [x29, #-96]
Lloh5:
	adrp	x8, _MAXHOSTNAMELEN@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MAXHOSTNAMELEN@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	add	w22, w8, #13
	mov	x9, x22
Lloh8:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh9:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x8, sp
	add	x9, x22, #15
	and	x9, x9, #0x1fffffff0
	sub	x23, x8, x9
	mov	sp, x23
Lloh10:
	adrp	x8, _fetch_to_fd.mirror_type@PAGE
Lloh11:
	ldr	x8, [x8, _fetch_to_fd.mirror_type@PAGEOFF]
	cbz	x8, LBB0_15
LBB0_1:
	mov	x0, x26
	bl	_mkstemp
	mov	x21, x0
	cmn	w0, #1
	b.eq	LBB0_17
; %bb.2:
	mov	x0, x25
	bl	_fetchParseURL
	cbz	x0, LBB0_18
; %bb.3:
	mov	x24, x0
	stp	x26, x20, [x19, #8]             ; 16-byte Folded Spill
	mov	x25, #0
	mov	x27, #0
	mov	w20, #3
Lloh12:
	adrp	x28, l_.str.6@PAGE
Lloh13:
	add	x28, x28, l_.str.6@PAGEOFF
	cmp	w20, #3
	b.ne	LBB0_9
LBB0_4:
	ldr	x0, [x24]
Lloh14:
	adrp	x1, l_.str.3@PAGE
Lloh15:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_strcmp
	cbz	x0, LBB0_9
; %bb.5:
Lloh16:
	adrp	x8, _fetch_to_fd.mirror_type@PAGE
Lloh17:
	ldr	x0, [x8, _fetch_to_fd.mirror_type@PAGEOFF]
Lloh18:
	adrp	x1, l_.str.4@PAGE
Lloh19:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_strcasecmp
	cbnz	x0, LBB0_9
; %bb.6:
	ldp	x3, x4, [x24]
	mov	x0, x23
	mov	x1, x22
Lloh20:
	adrp	x2, l_.str.5@PAGE
Lloh21:
	add	x2, x2, l_.str.5@PAGEOFF
	bl	_snprintf
	mov	x0, x23
	bl	_dns_getsrvinfo
	mov	x27, x0
	mov	x25, x0
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_9 Depth=1
	ldr	x8, [x27]
	cmp	x8, #0
	csel	x27, x25, x8, eq
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	sub	w20, w20, #1
	cmp	w20, #3
	b.eq	LBB0_4
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	cbz	x25, LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	x0, [x24, #8]
	ldr	w1, [x27, #12]
	mov	w2, #8
	bl	_strlcpy
	ldr	w8, [x27, #8]
	str	w8, [x24, #16]
LBB0_11:                                ;   in Loop: Header=BB0_9 Depth=1
	add	x1, x19, #24
	mov	x0, x24
	mov	x2, x28
	bl	_fetchXGet
	mov	x26, x0
	cbnz	x0, LBB0_19
; %bb.12:                               ;   in Loop: Header=BB0_9 Depth=1
	cmp	w20, #2
	b.lt	LBB0_25
; %bb.13:                               ;   in Loop: Header=BB0_9 Depth=1
	cbnz	x25, LBB0_7
; %bb.14:                               ;   in Loop: Header=BB0_9 Depth=1
	mov	w0, #1
	bl	_sleep
	b	LBB0_8
LBB0_15:
Lloh22:
	adrp	x8, _MIRROR_TYPE@GOTPAGE
Lloh23:
	ldr	x8, [x8, _MIRROR_TYPE@GOTPAGEOFF]
Lloh24:
	ldr	w0, [x8]
Lloh25:
	adrp	x1, _fetch_to_fd.mirror_type@PAGE
Lloh26:
	add	x1, x1, _fetch_to_fd.mirror_type@PAGEOFF
	bl	_config_string
	cbz	x0, LBB0_1
; %bb.16:
Lloh27:
	adrp	x0, l_.str@PAGE
Lloh28:
	add	x0, x0, l_.str@PAGEOFF
	bl	_warnx
	mov	w21, #-1
	b	LBB0_28
LBB0_17:
Lloh29:
	adrp	x0, l_.str.1@PAGE
Lloh30:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_warn
	b	LBB0_28
LBB0_18:
	str	x25, [sp, #-16]!
Lloh31:
	adrp	x0, l_.str.2@PAGE
Lloh32:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_warn
	add	sp, sp, #16
	mov	w21, #-1
	b	LBB0_28
LBB0_19:
Lloh33:
	adrp	x22, l_.str.7@PAGE
Lloh34:
	add	x22, x22, l_.str.7@PAGEOFF
LBB0_20:                                ; =>This Inner Loop Header: Depth=1
	add	x0, x19, #32
	mov	w1, #1
	mov	w2, #10240
	mov	x3, x26
	bl	_fread
	mov	x23, x0
	cmp	x0, #1
	b.lt	LBB0_22
; %bb.21:                               ;   in Loop: Header=BB0_20 Depth=1
	add	x1, x19, #32
	mov	x0, x21
	mov	x2, x23
	bl	_write
	cmp	x0, x23
	b.eq	LBB0_20
	b	LBB0_24
LBB0_22:
	cbz	x23, LBB0_30
; %bb.23:
Lloh35:
	adrp	x22, l_.str.8@PAGE
Lloh36:
	add	x22, x22, l_.str.8@PAGEOFF
LBB0_24:
	mov	x0, x22
	bl	_warn
LBB0_25:
	mov	x0, x21
	bl	_close
	ldr	x0, [x19, #8]                   ; 8-byte Folded Reload
	bl	_unlink
	mov	w21, #-1
LBB0_26:
	ldr	x20, [x19, #16]                 ; 8-byte Folded Reload
	cbz	x26, LBB0_28
; %bb.27:
	mov	x0, x26
	bl	_fclose
LBB0_28:
	mov	sp, x20
	ldur	x8, [x29, #-96]
Lloh37:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh38:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh39:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_31
; %bb.29:
	mov	x0, x21
	sub	sp, x29, #80
	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
	ret
LBB0_30:
	mov	x0, x26
	bl	_ferror
	cbnz	x0, LBB0_25
	b	LBB0_26
LBB0_31:
	bl	___stack_chk_fail
	.loh AdrpLdr	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdr	Lloh16, Lloh17
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.comm	_MAXHOSTNAMELEN,4,2             ; @MAXHOSTNAMELEN
.zerofill __DATA,__bss,_fetch_to_fd.mirror_type,8,3 ; @fetch_to_fd.mirror_type
	.comm	_MIRROR_TYPE,4,2                ; @MIRROR_TYPE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No MIRROR_TYPE defined"

l_.str.1:                               ; @.str.1
	.asciz	"mkstemp()"

l_.str.2:                               ; @.str.2
	.asciz	"fetchParseURL('%s')"

l_.str.3:                               ; @.str.3
	.asciz	"file"

l_.str.4:                               ; @.str.4
	.asciz	"srv"

l_.str.5:                               ; @.str.5
	.asciz	"_%s._tcp.%s"

l_.str.6:                               ; @.str.6
	.space	1

l_.str.7:                               ; @.str.7
	.asciz	"write()"

l_.str.8:                               ; @.str.8
	.asciz	"An error occurred while fetching pkg(8)"

	.no_dead_strip	_fetch_to_fd
.subsections_via_symbols
