	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wq_init
_wq_init:                               ## @wq_init
	.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
	movl	%esi, %r14d
	movq	%rdi, %r12
	leaq	L_.str(%rip), %rdi
	callq	_getenv
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	%rax, %rdi
	callq	_atoi
	movq	%rax, %r15
	jmp	LBB0_3
LBB0_2:
	movq	_MERGE_PHASE1_MAX_SLOTS@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
LBB0_3:
	leaq	L_.str.1(%rip), %rdi
	callq	_getenv
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movq	%rax, %rdi
	callq	_atoi
	movq	%rax, %rcx
	jmp	LBB0_6
LBB0_5:
	movq	_MERGE_PHASE1_BATCH_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
LBB0_6:
	movl	%ecx, (%r12)
	leal	(%r14,%rcx), %eax
	decl	%eax
	cltd
	idivl	%ecx
	movl	%r15d, %edi
	movl	%eax, %esi
	callq	_MIN
	movq	%rax, %r15
	leal	(,%rax,4), %edi
	callq	_xcalloc
	movq	%rax, 112(%r12)
	movl	%r15d, 4(%r12)
	movq	__SC_NPROCESSORS_ONLN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_sysconf
                                        ## kill: def $eax killed $eax def $rax
	leal	(%rax,%rax,2), %eax
	movl	%eax, %edi
	shrl	$31, %edi
	addl	%eax, %edi
	sarl	%edi
	movl	%r15d, %esi
	callq	_MIN
	movl	%eax, 8(%r12)
	leal	(,%rax,4), %edi
	callq	_xmalloc
	movl	%eax, 120(%r12)
	leaq	L_.str.2(%rip), %rdi
	callq	_getenv
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	movq	%rax, %rdi
	callq	_atoi
	jmp	LBB0_9
LBB0_8:
	movq	_MERGE_INPUT_THROTTLE_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_9:
	movl	4(%r12), %edx
	movl	8(%r12), %ecx
	imull	%ecx, %eax
	movl	%eax, 12(%r12)
	leaq	L_.str.3(%rip), %rsi
	movl	$1, %edi
	callq	_debug
	movq	$0, 104(%r12)
	testl	%r15d, %r15d
	jle	LBB0_12
## %bb.10:
	movl	%r15d, %r15d
	movq	112(%r12), %rax
	shlq	$4, %r15
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	leaq	(%rax,%rbx), %rdi
	addq	$8, %rdi
	xorl	%esi, %esi
	callq	_pthread_mutex_init
	movq	104(%r12), %rcx
	movq	112(%r12), %rax
	leaq	1(%rcx), %rdx
	movq	%rdx, 104(%r12)
	movq	%rcx, (%rax,%rbx)
	addq	$16, %rbx
	cmpq	%rbx, %r15
	jne	LBB0_11
LBB0_12:
	leaq	96(%r12), %rdi
	xorl	%esi, %esi
	callq	_pthread_mutex_init
	xorl	%eax, %eax
	callq	_fifo_new
	movq	%rax, 88(%r12)
	leaq	84(%r12), %rdi
	xorl	%esi, %esi
	callq	_pthread_cond_init
	leaq	80(%r12), %rdi
	xorl	%esi, %esi
	callq	_pthread_cond_init
	movl	%r14d, 16(%r12)
	movq	$0, 72(%r12)
	leaq	64(%r12), %rdi
	xorl	%esi, %esi
	callq	_pthread_mutex_init
	xorl	%eax, %eax
	callq	_fifo_new
	movq	%rax, 56(%r12)
	movl	$-1, 20(%r12)
	leaq	52(%r12), %rdi
	xorl	%esi, %esi
	callq	_pthread_cond_init
	leaq	48(%r12), %rdi
	xorl	%esi, %esi
	callq	_pthread_cond_init
	movq	$0, 40(%r12)
	leaq	36(%r12), %rdi
	movl	8(%r12), %esi
	callq	_barrier_init
	leaq	32(%r12), %rdi
	movl	8(%r12), %esi
	callq	_barrier_init
	movq	$0, 24(%r12)
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"CTFMERGE_MAX_SLOTS"

	.comm	_MERGE_PHASE1_MAX_SLOTS,4,2     ## @MERGE_PHASE1_MAX_SLOTS
L_.str.1:                               ## @.str.1
	.asciz	"CTFMERGE_PHASE1_BATCH_SIZE"

	.comm	_MERGE_PHASE1_BATCH_SIZE,4,2    ## @MERGE_PHASE1_BATCH_SIZE
	.comm	__SC_NPROCESSORS_ONLN,4,2       ## @_SC_NPROCESSORS_ONLN
L_.str.2:                               ## @.str.2
	.asciz	"CTFMERGE_INPUT_THROTTLE"

	.comm	_MERGE_INPUT_THROTTLE_LEN,4,2   ## @MERGE_INPUT_THROTTLE_LEN
L_.str.3:                               ## @.str.3
	.asciz	"Using %d slots, %d threads\n"

	.no_dead_strip	_wq_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wq_init
_wq_init:                               ; @wq_init
	.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
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_getenv
	cbz	x0, LBB0_2
; %bb.1:
	bl	_atoi
	mov	x21, x0
	b	LBB0_3
LBB0_2:
Lloh2:
	adrp	x8, _MERGE_PHASE1_MAX_SLOTS@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MERGE_PHASE1_MAX_SLOTS@GOTPAGEOFF]
Lloh4:
	ldr	w21, [x8]
LBB0_3:
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_getenv
	cbz	x0, LBB0_5
; %bb.4:
	bl	_atoi
	b	LBB0_6
LBB0_5:
Lloh7:
	adrp	x8, _MERGE_PHASE1_BATCH_SIZE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _MERGE_PHASE1_BATCH_SIZE@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
LBB0_6:
	str	w0, [x19]
	add	w8, w20, w0
	sub	w8, w8, #1
	sdiv	w1, w8, w0
	mov	x0, x21
	bl	_MIN
	mov	x21, x0
	lsl	w0, w21, #2
	bl	_xcalloc
	str	x0, [x19, #112]
	str	w21, [x19, #4]
Lloh10:
	adrp	x8, __SC_NPROCESSORS_ONLN@GOTPAGE
Lloh11:
	ldr	x8, [x8, __SC_NPROCESSORS_ONLN@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	bl	_sysconf
	add	w8, w0, w0, lsl #1
	cmp	w8, #0
	cinc	w8, w8, lt
	asr	w0, w8, #1
	mov	x1, x21
	bl	_MIN
	str	w0, [x19, #8]
	lsl	w0, w0, #2
	bl	_xmalloc
	str	w0, [x19, #120]
Lloh13:
	adrp	x0, l_.str.2@PAGE
Lloh14:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_getenv
	cbz	x0, LBB0_8
; %bb.7:
	bl	_atoi
	b	LBB0_9
LBB0_8:
Lloh15:
	adrp	x8, _MERGE_INPUT_THROTTLE_LEN@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MERGE_INPUT_THROTTLE_LEN@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
LBB0_9:
	ldp	w2, w3, [x19, #4]
	mul	w8, w3, w0
	str	w8, [x19, #12]
Lloh18:
	adrp	x1, l_.str.3@PAGE
Lloh19:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #1
	bl	_debug
	str	xzr, [x19, #104]
	cmp	w21, #1
	b.lt	LBB0_12
; %bb.10:
	mov	x22, #0
	and	x9, x21, #0xffffffff
	ldr	x8, [x19, #112]
	lsl	x21, x9, #4
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	add	x8, x8, x22
	add	x0, x8, #8
	mov	x1, #0
	bl	_pthread_mutex_init
	ldp	x9, x8, [x19, #104]
	add	x10, x9, #1
	str	x10, [x19, #104]
	str	x9, [x8, x22]
	add	x22, x22, #16
	cmp	x21, x22
	b.ne	LBB0_11
LBB0_12:
	add	x0, x19, #96
	mov	x1, #0
	bl	_pthread_mutex_init
	bl	_fifo_new
	str	x0, [x19, #88]
	add	x0, x19, #84
	mov	x1, #0
	bl	_pthread_cond_init
	add	x0, x19, #80
	mov	x1, #0
	bl	_pthread_cond_init
	str	w20, [x19, #16]
	str	xzr, [x19, #72]
	add	x0, x19, #64
	mov	x1, #0
	bl	_pthread_mutex_init
	bl	_fifo_new
	str	x0, [x19, #56]
	mov	w8, #-1
	str	w8, [x19, #20]
	add	x0, x19, #52
	mov	x1, #0
	bl	_pthread_cond_init
	add	x0, x19, #48
	mov	x1, #0
	bl	_pthread_cond_init
	str	xzr, [x19, #40]
	add	x0, x19, #36
	ldr	w1, [x19, #8]
	bl	_barrier_init
	add	x0, x19, #32
	ldr	w1, [x19, #8]
	bl	_barrier_init
	str	xzr, [x19, #24]
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"CTFMERGE_MAX_SLOTS"

	.comm	_MERGE_PHASE1_MAX_SLOTS,4,2     ; @MERGE_PHASE1_MAX_SLOTS
l_.str.1:                               ; @.str.1
	.asciz	"CTFMERGE_PHASE1_BATCH_SIZE"

	.comm	_MERGE_PHASE1_BATCH_SIZE,4,2    ; @MERGE_PHASE1_BATCH_SIZE
	.comm	__SC_NPROCESSORS_ONLN,4,2       ; @_SC_NPROCESSORS_ONLN
l_.str.2:                               ; @.str.2
	.asciz	"CTFMERGE_INPUT_THROTTLE"

	.comm	_MERGE_INPUT_THROTTLE_LEN,4,2   ; @MERGE_INPUT_THROTTLE_LEN
l_.str.3:                               ; @.str.3
	.asciz	"Using %d slots, %d threads\n"

	.no_dead_strip	_wq_init
.subsections_via_symbols
