	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WaitForService                 ## -- Begin function WaitForService
	.p2align	4, 0x90
_WaitForService:                        ## @WaitForService
	.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
	xorl	%ebx, %ebx
	testq	%rsi, %rsi
	cmovgq	%rsi, %rbx
	incq	%rbx
	movq	_SC_STATUS_PROCESS_INFO@GOTPCREL(%rip), %r13
	leaq	-52(%rbp), %r15
	movq	_SERVICE_RUNNING@GOTPCREL(%rip), %r14
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %esi
	movl	%r12d, %edi
	leaq	-48(%rbp), %rdx
                                        ## kill: def $edx killed $edx killed $rdx
	movl	$8, %ecx
	movq	%r15, %r8
	callq	_QueryServiceStatusEx
	testl	%eax, %eax
	je	LBB0_2
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	-48(%rbp), %rax
	cmpq	(%r14), %rax
	je	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$1000, %edi                     ## imm = 0x3E8
	callq	_Sleep
	decq	%rbx
	jne	LBB0_1
	jmp	LBB0_6
LBB0_2:
	xorl	%eax, %eax
	callq	_GetLastError
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	callq	_logmsg
LBB0_6:
	leaq	L_.str.1(%rip), %rdi
	movl	%r12d, %esi
	callq	_logmsg
	movq	_FALSE@GOTPCREL(%rip), %rax
	jmp	LBB0_7
LBB0_4:
	movq	_TRUE@GOTPCREL(%rip), %rax
LBB0_7:
	movl	(%rax), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SC_STATUS_PROCESS_INFO,4,2     ## @SC_STATUS_PROCESS_INFO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"QueryServiceStatusEx failed %x\n"

	.comm	_SERVICE_RUNNING,8,3            ## @SERVICE_RUNNING
	.comm	_TRUE,4,2                       ## @TRUE
L_.str.1:                               ## @.str.1
	.asciz	"Timeout while waiting for service to become ready %p\n"

	.comm	_FALSE,4,2                      ## @FALSE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WaitForService                 ; -- Begin function WaitForService
	.p2align	2
_WaitForService:                        ; @WaitForService
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x19, x0
	cmp	x1, #0
	csel	x8, x1, xzr, gt
	add	x21, x8, #1
Lloh0:
	adrp	x22, _SC_STATUS_PROCESS_INFO@GOTPAGE
Lloh1:
	ldr	x22, [x22, _SC_STATUS_PROCESS_INFO@GOTPAGEOFF]
Lloh2:
	adrp	x23, _SERVICE_RUNNING@GOTPAGE
Lloh3:
	ldr	x23, [x23, _SERVICE_RUNNING@GOTPAGEOFF]
Lloh4:
	adrp	x20, _TRUE@GOTPAGE
Lloh5:
	ldr	x20, [x20, _TRUE@GOTPAGEOFF]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x22]
	mov	x2, sp
	add	x4, sp, #12
	mov	x0, x19
	mov	w3, #8
	bl	_QueryServiceStatusEx
	cbz	w0, LBB0_4
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	x8, [sp]
	ldr	x9, [x23]
	cmp	x8, x9
	b.eq	LBB0_6
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w0, #1000
	bl	_Sleep
	subs	x21, x21, #1
	b.ne	LBB0_1
	b	LBB0_5
LBB0_4:
	bl	_GetLastError
	mov	x1, x0
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	bl	_logmsg
LBB0_5:
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x19
	bl	_logmsg
Lloh10:
	adrp	x20, _FALSE@GOTPAGE
Lloh11:
	ldr	x20, [x20, _FALSE@GOTPAGEOFF]
LBB0_6:
	ldr	w0, [x20]
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_SC_STATUS_PROCESS_INFO,4,2     ; @SC_STATUS_PROCESS_INFO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"QueryServiceStatusEx failed %x\n"

	.comm	_SERVICE_RUNNING,8,3            ; @SERVICE_RUNNING
	.comm	_TRUE,4,2                       ; @TRUE
l_.str.1:                               ; @.str.1
	.asciz	"Timeout while waiting for service to become ready %p\n"

	.comm	_FALSE,4,2                      ; @FALSE
.subsections_via_symbols
