	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_waitforjob                     ## -- Begin function waitforjob
	.p2align	4, 0x90
_waitforjob:                            ## @waitforjob
	.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
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	movq	_jobtab@GOTPCREL(%rip), %rax
	movq	%rdi, %rcx
	subq	(%rax), %rcx
	sarq	$3, %rcx
	movabsq	$-6148914691236517205, %rdi     ## imm = 0xAAAAAAAAAAAAAAAB
	imulq	%rcx, %rdi
	incq	%rdi
	callq	_TRACE
	cmpq	$0, (%rbx)
	je	LBB0_1
LBB0_5:
	movq	%rbx, %rdi
	callq	_getjobstatus
	movl	%eax, %r14d
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	testq	%r15, %r15
	je	LBB0_7
## %bb.6:
	movl	%r14d, %edi
	callq	_WIFSIGNALED
	movl	%eax, (%r15)
LBB0_7:
	movl	%r14d, %edi
	callq	_WIFEXITED
	movl	%r14d, %edi
	testq	%rax, %rax
	je	LBB0_9
## %bb.8:
	callq	_WEXITSTATUS
	movl	%eax, %r15d
	jmp	LBB0_10
LBB0_1:
	movq	_Tflag@GOTPCREL(%rip), %r12
	movq	_DOWAIT_SIG@GOTPCREL(%rip), %r13
	movq	_DOWAIT_SIG_TRAP@GOTPCREL(%rip), %r15
	xorl	%r14d, %r14d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	cmpq	$0, (%rbx)
	jne	LBB0_5
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r15), %edi
	orl	(%r13), %edi
	cmpq	$0, (%r12)
	cmovel	%r14d, %edi
	movq	_DOWAIT_BLOCK@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	%rbx, %rsi
	callq	_dowait
	cmpl	$-1, %eax
	jne	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	xorl	%eax, %eax
	callq	_dotrap
	jmp	LBB0_4
LBB0_9:
	callq	_WTERMSIG
	movl	%eax, %r15d
	subl	$-128, %r15d
LBB0_10:
	movq	_JOBS@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_12
## %bb.11:
	movq	(%rbx), %rax
	movq	_JOBDONE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_13
LBB0_12:
	movq	%rbx, %rdi
	callq	_freejob
LBB0_13:
	xorl	%eax, %eax
	callq	_int_pending
	testq	%rax, %rax
	je	LBB0_16
## %bb.14:
	movl	%r14d, %edi
	callq	_WIFSIGNALED
	testl	%eax, %eax
	je	LBB0_16
## %bb.15:
	movl	%r14d, %edi
	callq	_WTERMSIG
LBB0_16:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_INTOFF,4,2                     ## @INTOFF
	.comm	_jobtab,8,3                     ## @jobtab
	.comm	_DOWAIT_BLOCK,4,2               ## @DOWAIT_BLOCK
	.comm	_Tflag,8,3                      ## @Tflag
	.comm	_DOWAIT_SIG,4,2                 ## @DOWAIT_SIG
	.comm	_DOWAIT_SIG_TRAP,4,2            ## @DOWAIT_SIG_TRAP
	.comm	_JOBS,4,2                       ## @JOBS
	.comm	_JOBDONE,8,3                    ## @JOBDONE
	.comm	_SIGINT,4,2                     ## @SIGINT
	.comm	_CLEAR_PENDING_INT,4,2          ## @CLEAR_PENDING_INT
	.comm	_INTON,4,2                      ## @INTON
	.comm	_JOBSTOPPED,8,3                 ## @JOBSTOPPED
	.comm	_errno,4,2                      ## @errno
	.comm	_rootpid,4,2                    ## @rootpid
	.comm	_rootshell,8,3                  ## @rootshell
	.comm	_ttyfd,8,3                      ## @ttyfd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_waitforjob                     ; -- Begin function waitforjob
	.p2align	2
_waitforjob:                            ; @waitforjob
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _jobtab@GOTPAGE
Lloh1:
	ldr	x8, [x8, _jobtab@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	sub	x8, x0, x8
	asr	x8, x8, #3
	mov	x9, #-6148914691236517206
	movk	x9, #43691
	orr	x10, xzr, #0x1
	madd	x0, x8, x9, x10
	bl	_TRACE
	ldr	x8, [x19]
	cbz	x8, LBB0_5
LBB0_1:
	mov	x0, x19
	bl	_getjobstatus
	mov	x20, x0
	cbz	x21, LBB0_3
; %bb.2:
	mov	x0, x20
	bl	_WIFSIGNALED
	str	w0, [x21]
LBB0_3:
	mov	x0, x20
	bl	_WIFEXITED
	cbz	x0, LBB0_9
; %bb.4:
	mov	x0, x20
	bl	_WEXITSTATUS
	mov	x21, x0
	b	LBB0_10
LBB0_5:
Lloh3:
	adrp	x20, _DOWAIT_BLOCK@GOTPAGE
Lloh4:
	ldr	x20, [x20, _DOWAIT_BLOCK@GOTPAGEOFF]
Lloh5:
	adrp	x22, _Tflag@GOTPAGE
Lloh6:
	ldr	x22, [x22, _Tflag@GOTPAGEOFF]
Lloh7:
	adrp	x23, _DOWAIT_SIG@GOTPAGE
Lloh8:
	ldr	x23, [x23, _DOWAIT_SIG@GOTPAGEOFF]
Lloh9:
	adrp	x24, _DOWAIT_SIG_TRAP@GOTPAGE
Lloh10:
	ldr	x24, [x24, _DOWAIT_SIG_TRAP@GOTPAGEOFF]
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	ldr	x8, [x19]
	cbnz	x8, LBB0_1
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x20]
	ldr	x9, [x22]
	ldr	w10, [x23]
	ldr	w11, [x24]
	orr	w10, w11, w10
	cmp	x9, #0
	csel	w9, wzr, w10, eq
	orr	w0, w9, w8
	mov	x1, x19
	bl	_dowait
	cmn	w0, #1
	b.ne	LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	bl	_dotrap
	b	LBB0_6
LBB0_9:
	mov	x0, x20
	bl	_WTERMSIG
	add	w21, w0, #128
LBB0_10:
Lloh11:
	adrp	x8, _JOBS@GOTPAGE
Lloh12:
	ldr	x8, [x8, _JOBS@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	cbz	w8, LBB0_12
; %bb.11:
	ldr	x8, [x19]
Lloh14:
	adrp	x9, _JOBDONE@GOTPAGE
Lloh15:
	ldr	x9, [x9, _JOBDONE@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_13
LBB0_12:
	mov	x0, x19
	bl	_freejob
LBB0_13:
	bl	_int_pending
	cbz	x0, LBB0_16
; %bb.14:
	mov	x0, x20
	bl	_WIFSIGNALED
	cbz	w0, LBB0_16
; %bb.15:
	mov	x0, x20
	bl	_WTERMSIG
LBB0_16:
	mov	x0, x21
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_INTOFF,4,2                     ; @INTOFF
	.comm	_jobtab,8,3                     ; @jobtab
	.comm	_DOWAIT_BLOCK,4,2               ; @DOWAIT_BLOCK
	.comm	_Tflag,8,3                      ; @Tflag
	.comm	_DOWAIT_SIG,4,2                 ; @DOWAIT_SIG
	.comm	_DOWAIT_SIG_TRAP,4,2            ; @DOWAIT_SIG_TRAP
	.comm	_JOBS,4,2                       ; @JOBS
	.comm	_JOBDONE,8,3                    ; @JOBDONE
	.comm	_SIGINT,4,2                     ; @SIGINT
	.comm	_CLEAR_PENDING_INT,4,2          ; @CLEAR_PENDING_INT
	.comm	_INTON,4,2                      ; @INTON
	.comm	_JOBSTOPPED,8,3                 ; @JOBSTOPPED
	.comm	_errno,4,2                      ; @errno
	.comm	_rootpid,4,2                    ; @rootpid
	.comm	_rootshell,8,3                  ; @rootshell
	.comm	_ttyfd,8,3                      ; @ttyfd
.subsections_via_symbols
