	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tftp_open
_tftp_open:                             ## @tftp_open
	.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	_netproto@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_NET_TFTP@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_10
## %bb.1:
	movq	%rsi, %r13
	movq	16(%rsi), %rax
	movq	(%rax), %rax
	movq	_DEVT_NET@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_10
## %bb.2:
	movq	_is_open@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_4
## %bb.3:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_4:
	movq	%rdi, %r15
	movl	$1, %edi
	movl	$40, %esi
	callq	_calloc
	testq	%rax, %rax
	je	LBB0_20
## %bb.5:
	movq	%rax, %r14
	movq	_TFTP_REQUESTED_BLKSIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%r14)
	movq	8(%r13), %rax
	movl	(%rax), %edi
	callq	_socktodesc
	movq	%rax, 24(%r14)
	testq	%rax, %rax
	je	LBB0_9
## %bb.6:
	movq	_servip@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, (%rax)
	movq	$0, 16(%r14)
	movq	_rootpath@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	callq	_strlen
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_strlen
                                        ## kill: def $eax killed $eax def $rax
	addl	%eax, %ebx
	addl	$2, %ebx
	movslq	%ebx, %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_malloc
	movq	%rax, 8(%r14)
	testq	%rax, %rax
	je	LBB0_19
## %bb.7:
	movq	%rax, %r12
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movq	_rootpath@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movq	%rbx, %rdi
	callq	_strlen
	cltq
	cmpb	$47, -1(%rax,%rbx)
	jne	LBB0_13
## %bb.8:
	leaq	L_.str(%rip), %r8
	jmp	LBB0_14
LBB0_9:
	movq	%r14, %rdi
	callq	_free
LBB0_10:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_11:
	movl	(%rax), %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	cmpb	$47, (%r15)
	leaq	L_.str(%rip), %rax
	leaq	L_.str.1(%rip), %r8
	cmoveq	%rax, %r8
LBB0_14:
	movq	_rootpath@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	leaq	L_.str.2(%rip), %rdx
	movq	%r12, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	%r15, %r9
	callq	_snprintf
	testl	%eax, %eax
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	js	LBB0_18
## %bb.15:
	cmpl	%ecx, %eax
	ja	LBB0_18
## %bb.16:
	movq	%r14, %rdi
	callq	_tftp_makereq
	testl	%eax, %eax
	je	LBB0_21
## %bb.17:
	movl	%eax, %ebx
	movq	8(%r14), %rdi
	callq	_free
	movq	(%r14), %rdi
	callq	_free
	movq	%r14, %rdi
	callq	_free
	jmp	LBB0_12
LBB0_18:
	movq	%r12, %rdi
	callq	_free
LBB0_19:
	movq	%r14, %rdi
	callq	_free
LBB0_20:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_21:
	movq	%r14, (%r13)
	movq	_is_open@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	xorl	%ebx, %ebx
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_netproto,8,3                   ## @netproto
	.comm	_NET_TFTP,8,3                   ## @NET_TFTP
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_DEVT_NET,8,3                   ## @DEVT_NET
	.comm	_is_open,4,2                    ## @is_open
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_TFTP_REQUESTED_BLKSIZE,4,2     ## @TFTP_REQUESTED_BLKSIZE
	.comm	_servip,4,2                     ## @servip
	.comm	_rootpath,8,3                   ## @rootpath
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.space	1

L_.str.1:                               ## @.str.1
	.asciz	"/"

L_.str.2:                               ## @.str.2
	.asciz	"%s%s%s"

	.no_dead_strip	_tftp_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tftp_open
_tftp_open:                             ; @tftp_open
	.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
Lloh0:
	adrp	x8, _netproto@GOTPAGE
Lloh1:
	ldr	x8, [x8, _netproto@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x9, _NET_TFTP@GOTPAGE
Lloh4:
	ldr	x9, [x9, _NET_TFTP@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_14
; %bb.1:
	mov	x19, x1
	ldr	x8, [x1, #16]
	ldr	x8, [x8]
Lloh6:
	adrp	x9, _DEVT_NET@GOTPAGE
Lloh7:
	ldr	x9, [x9, _DEVT_NET@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_14
; %bb.2:
Lloh9:
	adrp	x25, _is_open@GOTPAGE
Lloh10:
	ldr	x25, [x25, _is_open@GOTPAGEOFF]
	ldr	w8, [x25]
	cbz	w8, LBB0_4
; %bb.3:
Lloh11:
	adrp	x8, _EBUSY@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_15
LBB0_4:
	mov	x21, x0
	mov	w0, #1
	mov	w1, #40
	bl	_calloc
	cbz	x0, LBB0_19
; %bb.5:
	mov	x20, x0
Lloh13:
	adrp	x8, _TFTP_REQUESTED_BLKSIZE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _TFTP_REQUESTED_BLKSIZE@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	str	w8, [x0, #32]
	ldr	x8, [x19, #8]
	ldr	w0, [x8]
	bl	_socktodesc
	str	x0, [x20, #24]
	cbz	x0, LBB0_13
; %bb.6:
Lloh16:
	adrp	x8, _servip@GOTPAGE
Lloh17:
	ldr	x8, [x8, _servip@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	str	w8, [x0]
	str	xzr, [x20, #16]
Lloh19:
	adrp	x26, _rootpath@GOTPAGE
Lloh20:
	ldr	x26, [x26, _rootpath@GOTPAGEOFF]
	ldr	x0, [x26]
	bl	_strlen
	mov	x22, x0
	mov	x0, x21
	bl	_strlen
	add	w8, w22, w0
	add	w8, w8, #2
	sxtw	x22, w8
	mov	x0, x22
	bl	_malloc
	str	x0, [x20, #8]
	cbz	x0, LBB0_18
; %bb.7:
	mov	x23, x0
	ldr	x24, [x26]
	mov	x0, x24
	bl	_strlen
	add	x8, x24, w0, sxtw
	ldurb	w8, [x8, #-1]
Lloh21:
	adrp	x4, l_.str@PAGE
Lloh22:
	add	x4, x4, l_.str@PAGEOFF
	cmp	w8, #47
	b.eq	LBB0_9
; %bb.8:
	ldrb	w8, [x21]
Lloh23:
	adrp	x9, l_.str.1@PAGE
Lloh24:
	add	x9, x9, l_.str.1@PAGEOFF
	cmp	w8, #47
	csel	x4, x4, x9, eq
LBB0_9:
	ldr	x3, [x26]
Lloh25:
	adrp	x2, l_.str.2@PAGE
Lloh26:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x0, x23
	mov	x1, x22
	mov	x5, x21
	bl	_snprintf
	tbnz	w0, #31, LBB0_17
; %bb.10:
	cmp	w0, w22
	b.hi	LBB0_17
; %bb.11:
	mov	x0, x20
	bl	_tftp_makereq
	mov	x21, x0
	cbz	w0, LBB0_20
; %bb.12:
	ldr	x0, [x20, #8]
	bl	_free
	ldr	x0, [x20]
	bl	_free
	mov	x0, x20
	bl	_free
	b	LBB0_16
LBB0_13:
	mov	x0, x20
	bl	_free
LBB0_14:
Lloh27:
	adrp	x8, _EINVAL@GOTPAGE
Lloh28:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_15:
	ldr	w21, [x8]
LBB0_16:
	mov	x0, x21
	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_17:
	mov	x0, x23
	bl	_free
LBB0_18:
	mov	x0, x20
	bl	_free
LBB0_19:
Lloh29:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh30:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_15
LBB0_20:
	str	x20, [x19]
	mov	w8, #1
	str	w8, [x25]
	b	LBB0_16
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_netproto,8,3                   ; @netproto
	.comm	_NET_TFTP,8,3                   ; @NET_TFTP
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_DEVT_NET,8,3                   ; @DEVT_NET
	.comm	_is_open,4,2                    ; @is_open
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_TFTP_REQUESTED_BLKSIZE,4,2     ; @TFTP_REQUESTED_BLKSIZE
	.comm	_servip,4,2                     ; @servip
	.comm	_rootpath,8,3                   ; @rootpath
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.space	1

l_.str.1:                               ; @.str.1
	.asciz	"/"

l_.str.2:                               ; @.str.2
	.asciz	"%s%s%s"

	.no_dead_strip	_tftp_open
.subsections_via_symbols
