	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function read_thread_wait
_read_thread_wait:                      ## @read_thread_wait
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_adist_remote_mtx@GOTPCREL(%rip), %rdi
	callq	_mtx_lock
	movq	_adhost@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	cmpl	$0, (%rax)
	je	LBB0_1
LBB0_2:
	movl	$0, (%rax)
	movq	_adist_trail@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	callq	_trail_filefd
	cmpl	$-1, %eax
	je	LBB0_4
## %bb.3:
	movl	(%r12), %edi
	callq	_trail_close
LBB0_4:
	movl	(%r12), %edi
	callq	_trail_reset
	movq	(%r15), %rax
	cmpq	$0, 16(%rax)
	jne	LBB0_7
## %bb.5:
	movq	_adist_remote_cond@GOTPCREL(%rip), %r14
	movq	_adist_remote_mtx@GOTPCREL(%rip), %rbx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_cv_wait
	movq	(%r15), %rax
	cmpq	$0, 16(%rax)
	je	LBB0_6
LBB0_7:
	movl	(%r12), %edi
	movl	8(%rax), %edx
	movl	12(%rax), %esi
	callq	_trail_start
	xorl	%ebx, %ebx
LBB0_8:
	movq	_adist_remote_mtx@GOTPCREL(%rip), %rdi
	callq	_mtx_unlock
	movq	_adist_trail@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	callq	_trail_filefd
	cmpl	$-1, %eax
	jne	LBB0_14
## %bb.9:
	movq	_adist_remote_mtx@GOTPCREL(%rip), %rbx
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_10 Depth=1
	movl	(%r12), %edi
	callq	_trail_filefd
	cmpl	$-1, %eax
	jne	LBB0_15
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_wait_for_dir
	movq	%rbx, %rdi
	callq	_mtx_lock
	movq	(%r15), %rax
	cmpl	$0, (%rax)
	jne	LBB0_2
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	%rbx, %rdi
	callq	_mtx_unlock
	movl	(%r12), %edi
	callq	_trail_filefd
	cmpl	$-1, %eax
	jne	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	(%r12), %edi
	callq	_trail_next
	jmp	LBB0_13
LBB0_1:
	movb	$1, %bl
	jmp	LBB0_8
LBB0_14:
	xorl	%r14d, %r14d
	testb	$1, %bl
	jne	LBB0_16
LBB0_15:
	movq	(%r15), %rax
	movl	4(%rax), %ebx
	movl	(%r12), %edi
	callq	_trail_filename
	leaq	L_.str(%rip), %rsi
	movl	$1, %r14d
	movl	$1, %edi
	movl	%ebx, %edx
	movl	%eax, %ecx
	callq	_pjdlog_debug
	movl	(%r12), %edi
	callq	_trail_filefd
	movl	%eax, %edi
	callq	_wait_for_file_init
LBB0_16:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_adist_remote_mtx,4,2           ## @adist_remote_mtx
	.comm	_adhost,8,3                     ## @adhost
	.comm	_adist_trail,4,2                ## @adist_trail
	.comm	_adist_remote_cond,4,2          ## @adist_remote_cond
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Trail file \"%s/%s\" opened."

	.no_dead_strip	_read_thread_wait
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function read_thread_wait
_read_thread_wait:                      ; @read_thread_wait
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
Lloh0:
	adrp	x0, _adist_remote_mtx@GOTPAGE
Lloh1:
	ldr	x0, [x0, _adist_remote_mtx@GOTPAGEOFF]
	bl	_mtx_lock
Lloh2:
	adrp	x22, _adhost@GOTPAGE
Lloh3:
	ldr	x22, [x22, _adhost@GOTPAGEOFF]
	ldr	x8, [x22]
	ldr	w9, [x8]
Lloh4:
	adrp	x21, _adist_trail@GOTPAGE
Lloh5:
	ldr	x21, [x21, _adist_trail@GOTPAGEOFF]
	cbz	w9, LBB0_13
LBB0_1:
	str	wzr, [x8]
	ldr	w0, [x21]
	bl	_trail_filefd
	cmn	w0, #1
	b.eq	LBB0_3
; %bb.2:
	ldr	w0, [x21]
	bl	_trail_close
LBB0_3:
	ldr	w0, [x21]
	bl	_trail_reset
	ldr	x8, [x22]
	ldr	x9, [x8, #16]
	cbnz	x9, LBB0_6
; %bb.4:
Lloh6:
	adrp	x19, _adist_remote_cond@GOTPAGE
Lloh7:
	ldr	x19, [x19, _adist_remote_cond@GOTPAGEOFF]
Lloh8:
	adrp	x20, _adist_remote_mtx@GOTPAGE
Lloh9:
	ldr	x20, [x20, _adist_remote_mtx@GOTPAGEOFF]
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x20
	bl	_cv_wait
	ldr	x8, [x22]
	ldr	x9, [x8, #16]
	cbz	x9, LBB0_5
LBB0_6:
	ldr	w0, [x21]
	ldp	w2, w1, [x8, #8]
	bl	_trail_start
	mov	w19, #0
LBB0_7:
Lloh10:
	adrp	x0, _adist_remote_mtx@GOTPAGE
Lloh11:
	ldr	x0, [x0, _adist_remote_mtx@GOTPAGEOFF]
	bl	_mtx_unlock
	ldr	w0, [x21]
	bl	_trail_filefd
	cmn	w0, #1
	b.ne	LBB0_14
; %bb.8:
Lloh12:
	adrp	x19, _adist_remote_mtx@GOTPAGE
Lloh13:
	ldr	x19, [x19, _adist_remote_mtx@GOTPAGEOFF]
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	ldr	w0, [x21]
	bl	_trail_filefd
	cmn	w0, #1
	b.ne	LBB0_16
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	bl	_wait_for_dir
	mov	x0, x19
	bl	_mtx_lock
	ldr	x8, [x22]
	ldr	w9, [x8]
	cbnz	w9, LBB0_1
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x19
	bl	_mtx_unlock
	ldr	w0, [x21]
	bl	_trail_filefd
	cmn	w0, #1
	b.ne	LBB0_9
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	w0, [x21]
	bl	_trail_next
	b	LBB0_9
LBB0_13:
	mov	w19, #1
	b	LBB0_7
LBB0_14:
	tbz	w19, #0, LBB0_16
; %bb.15:
	mov	w19, #0
	b	LBB0_17
LBB0_16:
	ldr	x8, [x22]
	ldr	w20, [x8, #4]
	ldr	w0, [x21]
	bl	_trail_filename
	mov	x3, x0
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	mov	w19, #1
	mov	w0, #1
	mov	x2, x20
	bl	_pjdlog_debug
	ldr	w0, [x21]
	bl	_trail_filefd
	bl	_wait_for_file_init
LBB0_17:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_adist_remote_mtx,4,2           ; @adist_remote_mtx
	.comm	_adhost,8,3                     ; @adhost
	.comm	_adist_trail,4,2                ; @adist_trail
	.comm	_adist_remote_cond,4,2          ; @adist_remote_cond
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Trail file \"%s/%s\" opened."

	.no_dead_strip	_read_thread_wait
.subsections_via_symbols
