	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function thread_juggle
_thread_juggle:                         ## @thread_juggle
	.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
	movl	%edi, %r12d
	movl	%esi, -64(%rbp)
	movq	_threaded_pipeline@GOTPCREL(%rip), %rax
	movl	%edx, -52(%rbp)                 ## 4-byte Spill
	movl	%edx, (%rax)
	movq	_threaded_mtx@GOTPCREL(%rip), %rdi
	xorl	%esi, %esi
	callq	_pthread_mutex_init
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_2:
	movq	_juggling_thread@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-60(%rbp), %rdi
	leaq	-64(%rbp), %rcx
	xorl	%esi, %esi
	callq	_pthread_create
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	leaq	L_.str.1(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_4:
	movq	_threaded_mtx@GOTPCREL(%rip), %rdi
	callq	_pthread_mutex_lock
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	leaq	L_.str.2(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_6:
	movq	_threaded_child_ready@GOTPCREL(%rip), %r13
	cmpl	$0, (%r13)
	je	LBB0_7
LBB0_11:
	movq	_threaded_mtx@GOTPCREL(%rip), %rdi
	callq	_pthread_mutex_unlock
	testq	%rax, %rax
	je	LBB0_13
## %bb.12:
	leaq	L_.str.4(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_13:
	movq	_CLOCK_REALTIME@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-56(%rbp), %rsi
	callq	_clock_gettime
	testq	%rax, %rax
	jns	LBB0_15
## %bb.14:
	leaq	L_.str.5(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_15:
	movq	_NUMCYCLES@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_26
## %bb.16:
	xorl	%r13d, %r13d
	leaq	L_.str.6(%rip), %r15
	jmp	LBB0_17
	.p2align	4, 0x90
LBB0_25:                                ##   in Loop: Header=BB0_17 Depth=1
	incl	%r13d
	movq	_NUMCYCLES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	jge	LBB0_26
LBB0_17:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_18 Depth 2
                                        ##     Child Loop BB0_22 Depth 2
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, %r14d
	testl	%eax, %eax
	jg	LBB0_18
	jmp	LBB0_25
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_18 Depth=2
	decl	%r14d
	je	LBB0_21
LBB0_18:                                ##   Parent Loop BB0_17 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	%r12d, %edi
	callq	_message_send
	testq	%rax, %rax
	jns	LBB0_20
## %bb.19:                              ##   in Loop: Header=BB0_18 Depth=2
	movl	$-1, %edi
	movq	%r15, %rsi
	callq	_err
	jmp	LBB0_20
	.p2align	4, 0x90
LBB0_21:                                ##   in Loop: Header=BB0_17 Depth=1
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, %ebx
	testl	%eax, %eax
	jg	LBB0_22
	jmp	LBB0_25
	.p2align	4, 0x90
LBB0_24:                                ##   in Loop: Header=BB0_22 Depth=2
	decl	%ebx
	je	LBB0_25
LBB0_22:                                ##   Parent Loop BB0_17 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	%r12d, %edi
	callq	_message_recv
	testq	%rax, %rax
	jns	LBB0_24
## %bb.23:                              ##   in Loop: Header=BB0_22 Depth=2
	movl	$-1, %edi
	leaq	L_.str.7(%rip), %rsi
	callq	_err
	jmp	LBB0_24
LBB0_26:
	movq	_CLOCK_REALTIME@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-48(%rbp), %rsi
	callq	_clock_gettime
	testq	%rax, %rax
	jns	LBB0_28
## %bb.27:
	leaq	L_.str.5(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_28:
	movl	-60(%rbp), %edi
	xorl	%esi, %esi
	callq	_pthread_join
	testq	%rax, %rax
	je	LBB0_30
## %bb.29:
	leaq	L_.str.8(%rip), %rsi
	movl	$-1, %edi
	callq	_err
LBB0_30:
	leaq	-56(%rbp), %rsi
	leaq	-48(%rbp), %rdi
	movq	%rdi, %rdx
	callq	_timespecsub
	movl	-48(%rbp), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_threaded_cond@GOTPCREL(%rip), %r15
	movq	_threaded_mtx@GOTPCREL(%rip), %rbx
	leaq	L_.str.3(%rip), %r14
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_8 Depth=1
	cmpl	$0, (%r13)
	jne	LBB0_11
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_pthread_cond_wait
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movl	$-1, %edi
	movq	%r14, %rsi
	callq	_err
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_threaded_pipeline,4,2          ## @threaded_pipeline
	.comm	_threaded_mtx,4,2               ## @threaded_mtx
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"thread_juggle: pthread_mutex_init"

	.comm	_juggling_thread,4,2            ## @juggling_thread
L_.str.1:                               ## @.str.1
	.asciz	"thread_juggle: pthread_create"

L_.str.2:                               ## @.str.2
	.asciz	"thread_juggle: pthread_mutex_lock"

	.comm	_threaded_child_ready,4,2       ## @threaded_child_ready
	.comm	_threaded_cond,4,2              ## @threaded_cond
L_.str.3:                               ## @.str.3
	.asciz	"thread_juggle: pthread_cond_wait"

L_.str.4:                               ## @.str.4
	.asciz	"thread_juggle: pthread_mutex_unlock"

	.comm	_CLOCK_REALTIME,4,2             ## @CLOCK_REALTIME
L_.str.5:                               ## @.str.5
	.asciz	"thread_juggle: clock_gettime"

	.comm	_NUMCYCLES,4,2                  ## @NUMCYCLES
L_.str.6:                               ## @.str.6
	.asciz	"message_send fd1"

L_.str.7:                               ## @.str.7
	.asciz	"message_recv fd1"

L_.str.8:                               ## @.str.8
	.asciz	"thread_juggle: pthread_join"

	.no_dead_strip	_thread_juggle
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function thread_juggle
_thread_juggle:                         ; @thread_juggle
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x19, x2
	mov	x20, x0
	str	w1, [sp, #20]
Lloh0:
	adrp	x8, _threaded_pipeline@GOTPAGE
Lloh1:
	ldr	x8, [x8, _threaded_pipeline@GOTPAGEOFF]
Lloh2:
	str	w2, [x8]
Lloh3:
	adrp	x0, _threaded_mtx@GOTPAGE
Lloh4:
	ldr	x0, [x0, _threaded_mtx@GOTPAGEOFF]
	mov	x1, #0
	bl	_pthread_mutex_init
	cbz	x0, LBB0_2
; %bb.1:
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_2:
Lloh7:
	adrp	x8, _juggling_thread@GOTPAGE
Lloh8:
	ldr	x8, [x8, _juggling_thread@GOTPAGEOFF]
Lloh9:
	ldr	w2, [x8]
	add	x0, sp, #12
	add	x3, sp, #20
	mov	x1, #0
	bl	_pthread_create
	cbz	x0, LBB0_4
; %bb.3:
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_4:
Lloh12:
	adrp	x0, _threaded_mtx@GOTPAGE
Lloh13:
	ldr	x0, [x0, _threaded_mtx@GOTPAGEOFF]
	bl	_pthread_mutex_lock
	cbz	x0, LBB0_6
; %bb.5:
Lloh14:
	adrp	x1, l_.str.2@PAGE
Lloh15:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_6:
Lloh16:
	adrp	x24, _threaded_child_ready@GOTPAGE
Lloh17:
	ldr	x24, [x24, _threaded_child_ready@GOTPAGEOFF]
	ldr	w8, [x24]
	cbz	w8, LBB0_27
LBB0_7:
Lloh18:
	adrp	x0, _threaded_mtx@GOTPAGE
Lloh19:
	ldr	x0, [x0, _threaded_mtx@GOTPAGEOFF]
	bl	_pthread_mutex_unlock
	cbz	x0, LBB0_9
; %bb.8:
Lloh20:
	adrp	x1, l_.str.4@PAGE
Lloh21:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_9:
Lloh22:
	adrp	x23, _CLOCK_REALTIME@GOTPAGE
Lloh23:
	ldr	x23, [x23, _CLOCK_REALTIME@GOTPAGEOFF]
	ldr	w0, [x23]
	add	x1, sp, #16
	bl	_clock_gettime
	tbz	x0, #63, LBB0_11
; %bb.10:
Lloh24:
	adrp	x1, l_.str.5@PAGE
Lloh25:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_11:
Lloh26:
	adrp	x24, _NUMCYCLES@GOTPAGE
Lloh27:
	ldr	x24, [x24, _NUMCYCLES@GOTPAGEOFF]
	ldr	w8, [x24]
	cmp	w8, #1
	b.lt	LBB0_22
; %bb.12:
	mov	w25, #0
Lloh28:
	adrp	x21, l_.str.6@PAGE
Lloh29:
	add	x21, x21, l_.str.6@PAGEOFF
Lloh30:
	adrp	x22, l_.str.7@PAGE
Lloh31:
	add	x22, x22, l_.str.7@PAGEOFF
	b	LBB0_14
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=1
	add	w25, w25, #1
	ldr	w8, [x24]
	cmp	w25, w8
	b.ge	LBB0_22
LBB0_14:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_16 Depth 2
                                        ;     Child Loop BB0_20 Depth 2
	mov	x26, x19
	cmp	w19, #1
	b.ge	LBB0_16
	b	LBB0_13
LBB0_15:                                ;   in Loop: Header=BB0_16 Depth=2
	subs	w26, w26, #1
	b.eq	LBB0_18
LBB0_16:                                ;   Parent Loop BB0_14 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x0, x20
	bl	_message_send
	tbz	x0, #63, LBB0_15
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=2
	mov	w0, #-1
	mov	x1, x21
	bl	_err
	b	LBB0_15
LBB0_18:                                ;   in Loop: Header=BB0_14 Depth=1
	mov	x26, x19
	cmp	w19, #1
	b.ge	LBB0_20
	b	LBB0_13
LBB0_19:                                ;   in Loop: Header=BB0_20 Depth=2
	subs	w26, w26, #1
	b.eq	LBB0_13
LBB0_20:                                ;   Parent Loop BB0_14 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x0, x20
	bl	_message_recv
	tbz	x0, #63, LBB0_19
; %bb.21:                               ;   in Loop: Header=BB0_20 Depth=2
	mov	w0, #-1
	mov	x1, x22
	bl	_err
	b	LBB0_19
LBB0_22:
	ldr	w0, [x23]
	add	x1, sp, #24
	bl	_clock_gettime
	tbz	x0, #63, LBB0_24
; %bb.23:
Lloh32:
	adrp	x1, l_.str.5@PAGE
Lloh33:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_24:
	ldr	w0, [sp, #12]
	mov	x1, #0
	bl	_pthread_join
	cbz	x0, LBB0_26
; %bb.25:
Lloh34:
	adrp	x1, l_.str.8@PAGE
Lloh35:
	add	x1, x1, l_.str.8@PAGEOFF
	mov	w0, #-1
	bl	_err
LBB0_26:
	add	x0, sp, #24
	add	x1, sp, #16
	add	x2, sp, #24
	bl	_timespecsub
	ldr	w0, [sp, #24]
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_27:
Lloh36:
	adrp	x21, _threaded_cond@GOTPAGE
Lloh37:
	ldr	x21, [x21, _threaded_cond@GOTPAGEOFF]
Lloh38:
	adrp	x22, _threaded_mtx@GOTPAGE
Lloh39:
	ldr	x22, [x22, _threaded_mtx@GOTPAGEOFF]
Lloh40:
	adrp	x23, l_.str.3@PAGE
Lloh41:
	add	x23, x23, l_.str.3@PAGEOFF
	b	LBB0_29
LBB0_28:                                ;   in Loop: Header=BB0_29 Depth=1
	ldr	w8, [x24]
	cbnz	w8, LBB0_7
LBB0_29:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	mov	x1, x22
	bl	_pthread_cond_wait
	cbz	x0, LBB0_28
; %bb.30:                               ;   in Loop: Header=BB0_29 Depth=1
	mov	w0, #-1
	mov	x1, x23
	bl	_err
	b	LBB0_28
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotStr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpLdrGot	Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh36, Lloh37
	.cfi_endproc
                                        ; -- End function
	.comm	_threaded_pipeline,4,2          ; @threaded_pipeline
	.comm	_threaded_mtx,4,2               ; @threaded_mtx
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"thread_juggle: pthread_mutex_init"

	.comm	_juggling_thread,4,2            ; @juggling_thread
l_.str.1:                               ; @.str.1
	.asciz	"thread_juggle: pthread_create"

l_.str.2:                               ; @.str.2
	.asciz	"thread_juggle: pthread_mutex_lock"

	.comm	_threaded_child_ready,4,2       ; @threaded_child_ready
	.comm	_threaded_cond,4,2              ; @threaded_cond
l_.str.3:                               ; @.str.3
	.asciz	"thread_juggle: pthread_cond_wait"

l_.str.4:                               ; @.str.4
	.asciz	"thread_juggle: pthread_mutex_unlock"

	.comm	_CLOCK_REALTIME,4,2             ; @CLOCK_REALTIME
l_.str.5:                               ; @.str.5
	.asciz	"thread_juggle: clock_gettime"

	.comm	_NUMCYCLES,4,2                  ; @NUMCYCLES
l_.str.6:                               ; @.str.6
	.asciz	"message_send fd1"

l_.str.7:                               ; @.str.7
	.asciz	"message_recv fd1"

l_.str.8:                               ; @.str.8
	.asciz	"thread_juggle: pthread_join"

	.no_dead_strip	_thread_juggle
.subsections_via_symbols
