	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WaitLatchOrSocket              ## -- Begin function WaitLatchOrSocket
	.p2align	4, 0x90
_WaitLatchOrSocket:                     ## @WaitLatchOrSocket
	.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	%r8d, -56(%rbp)                 ## 4-byte Spill
	movq	%rcx, %r15
	movl	%edx, -52(%rbp)                 ## 4-byte Spill
	movl	%esi, %ebx
	movq	%rdi, %r12
	movq	_CurrentMemoryContext@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	$3, %esi
	callq	_CreateWaitEventSet
	movq	%rax, %r13
	movq	_WL_TIMEOUT@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_1
## %bb.2:
	movq	%r15, %rdi
	shrq	$63, %rdi
	xorl	$1, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_Assert
	jmp	LBB0_3
LBB0_1:
	movq	$-1, %r15
LBB0_3:
	movq	_WL_LATCH_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	testl	%ebx, %esi
	je	LBB0_5
## %bb.4:
	movq	_PGINVALID_SOCKET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	movq	%r12, %rcx
	xorl	%r8d, %r8d
	callq	_AddWaitEventToSet
LBB0_5:
	movq	_IsUnderPostmaster@GOTPCREL(%rip), %r14
	movl	$1, %edi
	cmpq	$0, (%r14)
	je	LBB0_8
## %bb.6:
	movq	_WL_EXIT_ON_PM_DEATH@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	jne	LBB0_8
## %bb.7:
	movq	_WL_POSTMASTER_DEATH@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	testl	%ebx, (%rax)
	setne	%dil
LBB0_8:
	callq	_Assert
	movq	_WL_POSTMASTER_DEATH@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	(%r14), %rax
	testl	%ebx, %esi
	je	LBB0_11
## %bb.9:
	testq	%rax, %rax
	je	LBB0_11
## %bb.10:
	movq	_PGINVALID_SOCKET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_AddWaitEventToSet
	movq	(%r14), %rax
LBB0_11:
	movq	_WL_EXIT_ON_PM_DEATH@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	testl	%ebx, %esi
	je	LBB0_14
## %bb.12:
	testq	%rax, %rax
	je	LBB0_14
## %bb.13:
	movq	_PGINVALID_SOCKET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_AddWaitEventToSet
LBB0_14:
	movq	_WL_SOCKET_MASK@GOTPCREL(%rip), %r14
	andl	(%r14), %ebx
	je	LBB0_16
## %bb.15:
	movq	%r13, %rdi
	movl	%ebx, %esi
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_AddWaitEventToSet
LBB0_16:
	leaq	-48(%rbp), %rdx
	movq	%r13, %rdi
	movq	%r15, %rsi
	movl	$1, %ecx
	movl	-56(%rbp), %r8d                 ## 4-byte Reload
	callq	_WaitEventSetWait
	testl	%eax, %eax
	je	LBB0_17
## %bb.18:
	movl	(%r12), %ebx
	movq	_WL_LATCH_SET@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	orl	(%r14), %ebx
	andl	-48(%rbp), %ebx
	jmp	LBB0_19
LBB0_17:
	movq	_WL_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_19:
	movq	%r13, %rdi
	callq	_FreeWaitEventSet
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CurrentMemoryContext,4,2       ## @CurrentMemoryContext
	.comm	_WL_TIMEOUT,4,2                 ## @WL_TIMEOUT
	.comm	_WL_LATCH_SET,4,2               ## @WL_LATCH_SET
	.comm	_PGINVALID_SOCKET,4,2           ## @PGINVALID_SOCKET
	.comm	_IsUnderPostmaster,8,3          ## @IsUnderPostmaster
	.comm	_WL_EXIT_ON_PM_DEATH,4,2        ## @WL_EXIT_ON_PM_DEATH
	.comm	_WL_POSTMASTER_DEATH,4,2        ## @WL_POSTMASTER_DEATH
	.comm	_WL_SOCKET_MASK,4,2             ## @WL_SOCKET_MASK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WaitLatchOrSocket              ; -- Begin function WaitLatchOrSocket
	.p2align	2
_WaitLatchOrSocket:                     ; @WaitLatchOrSocket
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x4
	mov	x21, x3
	mov	x22, x2
	mov	x23, x1
	mov	x24, x0
Lloh0:
	adrp	x8, _CurrentMemoryContext@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CurrentMemoryContext@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	mov	w1, #3
	bl	_CreateWaitEventSet
	mov	x19, x0
Lloh3:
	adrp	x8, _WL_TIMEOUT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _WL_TIMEOUT@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	tst	w8, w23
	b.eq	LBB0_2
; %bb.1:
	lsr	x8, x21, #63
	eor	w0, w8, #0x1
	bl	_Assert
	b	LBB0_3
LBB0_2:
	mov	x21, #-1
LBB0_3:
Lloh6:
	adrp	x26, _WL_LATCH_SET@GOTPAGE
Lloh7:
	ldr	x26, [x26, _WL_LATCH_SET@GOTPAGEOFF]
	ldr	w1, [x26]
Lloh8:
	adrp	x27, _PGINVALID_SOCKET@GOTPAGE
Lloh9:
	ldr	x27, [x27, _PGINVALID_SOCKET@GOTPAGEOFF]
	tst	w1, w23
	b.eq	LBB0_5
; %bb.4:
	ldr	w2, [x27]
	mov	x0, x19
	mov	x3, x24
	mov	x4, #0
	bl	_AddWaitEventToSet
LBB0_5:
Lloh10:
	adrp	x25, _IsUnderPostmaster@GOTPAGE
Lloh11:
	ldr	x25, [x25, _IsUnderPostmaster@GOTPAGEOFF]
	ldr	x8, [x25]
Lloh12:
	adrp	x24, _WL_POSTMASTER_DEATH@GOTPAGE
Lloh13:
	ldr	x24, [x24, _WL_POSTMASTER_DEATH@GOTPAGEOFF]
Lloh14:
	adrp	x28, _WL_EXIT_ON_PM_DEATH@GOTPAGE
Lloh15:
	ldr	x28, [x28, _WL_EXIT_ON_PM_DEATH@GOTPAGEOFF]
	cbz	x8, LBB0_7
; %bb.6:
	ldr	w8, [x28]
	tst	w8, w23
	b.eq	LBB0_8
LBB0_7:
	mov	w0, #1
	b	LBB0_9
LBB0_8:
	ldr	w8, [x24]
	tst	w8, w23
	cset	w0, ne
LBB0_9:
	bl	_Assert
	ldr	w1, [x24]
	and	w9, w1, w23
	ldr	x8, [x25]
	cmp	w9, #0
	ccmp	x8, #0, #4, ne
	b.eq	LBB0_11
; %bb.10:
	ldr	w2, [x27]
	mov	x0, x19
	mov	x3, #0
	mov	x4, #0
	bl	_AddWaitEventToSet
	ldr	x8, [x25]
LBB0_11:
	ldr	w1, [x28]
	and	w9, w1, w23
	cmp	w9, #0
	ccmp	x8, #0, #4, ne
	b.eq	LBB0_13
; %bb.12:
	ldr	w2, [x27]
	mov	x0, x19
	mov	x3, #0
	mov	x4, #0
	bl	_AddWaitEventToSet
LBB0_13:
Lloh16:
	adrp	x25, _WL_SOCKET_MASK@GOTPAGE
Lloh17:
	ldr	x25, [x25, _WL_SOCKET_MASK@GOTPAGEOFF]
	ldr	w8, [x25]
	ands	w1, w8, w23
	b.eq	LBB0_15
; %bb.14:
	mov	x0, x19
	mov	x2, x22
	mov	x3, #0
	mov	x4, #0
	bl	_AddWaitEventToSet
LBB0_15:
	add	x2, sp, #8
	mov	x0, x19
	mov	x1, x21
	mov	w3, #1
	mov	x4, x20
	bl	_WaitEventSetWait
	cbz	w0, LBB0_17
; %bb.16:
	ldr	w8, [sp, #8]
	ldr	w9, [x26]
	ldr	w10, [x24]
	orr	w9, w10, w9
	ldr	w10, [x25]
	orr	w9, w9, w10
	and	w20, w9, w8
	b	LBB0_18
LBB0_17:
Lloh18:
	adrp	x8, _WL_TIMEOUT@GOTPAGE
Lloh19:
	ldr	x8, [x8, _WL_TIMEOUT@GOTPAGEOFF]
Lloh20:
	ldr	w20, [x8]
LBB0_18:
	mov	x0, x19
	bl	_FreeWaitEventSet
	mov	x0, x20
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_CurrentMemoryContext,4,2       ; @CurrentMemoryContext
	.comm	_WL_TIMEOUT,4,2                 ; @WL_TIMEOUT
	.comm	_WL_LATCH_SET,4,2               ; @WL_LATCH_SET
	.comm	_PGINVALID_SOCKET,4,2           ; @PGINVALID_SOCKET
	.comm	_IsUnderPostmaster,8,3          ; @IsUnderPostmaster
	.comm	_WL_EXIT_ON_PM_DEATH,4,2        ; @WL_EXIT_ON_PM_DEATH
	.comm	_WL_POSTMASTER_DEATH,4,2        ; @WL_POSTMASTER_DEATH
	.comm	_WL_SOCKET_MASK,4,2             ; @WL_SOCKET_MASK
.subsections_via_symbols
