	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_monitor_open                   ## -- Begin function monitor_open
	.p2align	4, 0x90
_monitor_open:                          ## @monitor_open
	.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	%edx, %r13d
	movq	%rsi, %r14
	movq	%rdi, %r12
	movq	(%rsi), %rax
	movq	_MONITOR_OPS_MAGIC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_error
LBB0_2:
	movq	104(%r14), %rax
	movq	_targ_ops@GOTPCREL(%rip), %r15
	movq	%rax, (%r15)
	movq	(%rax), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	testq	%r12, %r12
	jne	LBB0_4
## %bb.3:
	leaq	L_.str.1(%rip), %rdi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	%rdx, %rsi
	xorl	%eax, %eax
	callq	_error
LBB0_4:
	movl	%r13d, %edi
	callq	_target_preopen
	movq	96(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_6
## %bb.5:
	movq	_register_fastmap@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_register_pattern@GOTPCREL(%rip), %rsi
	callq	_compile_pattern
LBB0_6:
	movq	88(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_8
## %bb.7:
	movq	_getmem_resp_delim_fastmap@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_getmem_resp_delim_pattern@GOTPCREL(%rip), %rsi
	callq	_compile_pattern
LBB0_8:
	movq	80(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_10
## %bb.9:
	movq	_setmem_resp_delim_fastmap@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_setmem_resp_delim_pattern@GOTPCREL(%rip), %rsi
	callq	_compile_pattern
LBB0_10:
	movq	72(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_12
## %bb.11:
	movq	_setreg_resp_delim_fastmap@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_setreg_resp_delim_pattern@GOTPCREL(%rip), %rsi
	callq	_compile_pattern
LBB0_12:
	movq	(%r15), %rdi
	callq	_unpush_target
	movq	_dev_name@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_14
## %bb.13:
	callq	_xfree
LBB0_14:
	movq	%r12, %rdi
	callq	_xstrdup
	movq	%rax, (%rbx)
	movq	%rax, %rdi
	callq	_serial_open
	movq	_monitor_desc@GOTPCREL(%rip), %r12
	movl	%eax, (%r12)
	testl	%eax, %eax
	jne	LBB0_16
## %bb.15:
	movq	(%rbx), %rdi
	callq	_perror_with_name
LBB0_16:
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	movq	_baud_rate@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	cmpl	$-1, %esi
	je	LBB0_19
## %bb.17:
	movl	(%r12), %edi
	callq	_serial_setbaudrate
	testq	%rax, %rax
	je	LBB0_19
## %bb.18:
	movl	(%r12), %edi
	callq	_serial_close
	movq	(%rbx), %rdi
	callq	_perror_with_name
LBB0_19:
	movl	(%r12), %edi
	callq	_serial_raw
	movl	(%r12), %edi
	callq	_serial_flush_input
	movl	(%r12), %edi
	movl	64(%r14), %esi
	callq	_serial_setstopbits
	movq	_current_monitor@GOTPCREL(%rip), %rbx
	movq	%r14, (%rbx)
	cmpq	$0, 56(%r14)
	je	LBB0_22
## %bb.20:
	xorl	%eax, %eax
	callq	_monitor_stop
	movq	(%rbx), %rax
	movq	_MO_NO_ECHO_ON_OPEN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, 8(%rax)
	jne	LBB0_22
## %bb.21:
	leaq	L_.str.2(%rip), %rdi
	callq	_monitor_debug
	xorl	%edi, %edi
	xorl	%esi, %esi
	callq	_monitor_expect_prompt
LBB0_22:
	movq	16(%r14), %r15
	movq	(%r15), %rdi
	testq	%rdi, %rdi
	je	LBB0_28
## %bb.23:
	addq	$8, %r15
	movq	_MO_NO_ECHO_ON_OPEN@GOTPCREL(%rip), %r13
	jmp	LBB0_24
	.p2align	4, 0x90
LBB0_26:                                ##   in Loop: Header=BB0_24 Depth=1
	callq	_monitor_printf_noecho
LBB0_27:                                ##   in Loop: Header=BB0_24 Depth=1
	xorl	%edi, %edi
	xorl	%esi, %esi
	callq	_monitor_expect_prompt
	movq	(%r15), %rdi
	addq	$8, %r15
	testq	%rdi, %rdi
	je	LBB0_28
LBB0_24:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rax
	movl	(%r13), %ecx
	testl	%ecx, 8(%rax)
	jne	LBB0_26
## %bb.25:                              ##   in Loop: Header=BB0_24 Depth=1
	callq	_monitor_printf
	jmp	LBB0_27
LBB0_28:
	movl	(%r12), %edi
	callq	_serial_flush_input
	cmpq	$0, 48(%r14)
	movq	_targ_ops@GOTPCREL(%rip), %r15
	je	LBB0_32
## %bb.29:
	movl	24(%r14), %edi
	testl	%edi, %edi
	jne	LBB0_31
## %bb.30:
	movl	$8, 24(%r14)
	movl	$8, %edi
LBB0_31:
	shll	$2, %edi
	callq	_xmalloc
	movq	_breakaddr@GOTPCREL(%rip), %rcx
	movq	%rax, (%rcx)
	movl	24(%r14), %edx
	shll	$2, %edx
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	_memset
LBB0_32:
	movq	32(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_34
## %bb.33:
	callq	_monitor_printf
	xorl	%edi, %edi
	xorl	%esi, %esi
	callq	_monitor_expect_prompt
LBB0_34:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_36
## %bb.35:
	movq	_dev_name@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	leaq	L_.str.3(%rip), %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_printf_unfiltered
LBB0_36:
	movq	(%r15), %rdi
	callq	_push_target
	movl	$42000, %edi                    ## imm = 0xA410
	callq	_pid_to_ptid
	movq	_inferior_ptid@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movq	(%rbx), %rax
	movq	40(%rax), %rdi
	callq	_monitor_printf
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_start_remote                   ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_MONITOR_OPS_MAGIC,8,3          ## @MONITOR_OPS_MAGIC
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Magic number of monitor_ops struct wrong."

	.comm	_targ_ops,8,3                   ## @targ_ops
L_.str.1:                               ## @.str.1
	.asciz	"Use `target %s DEVICE-NAME' to use a serial port, or \n`target %s HOST-NAME:PORT-NUMBER' to use a network connection."

	.comm	_register_pattern,4,2           ## @register_pattern
	.comm	_register_fastmap,4,2           ## @register_fastmap
	.comm	_getmem_resp_delim_pattern,4,2  ## @getmem_resp_delim_pattern
	.comm	_getmem_resp_delim_fastmap,4,2  ## @getmem_resp_delim_fastmap
	.comm	_setmem_resp_delim_pattern,4,2  ## @setmem_resp_delim_pattern
	.comm	_setmem_resp_delim_fastmap,4,2  ## @setmem_resp_delim_fastmap
	.comm	_setreg_resp_delim_pattern,4,2  ## @setreg_resp_delim_pattern
	.comm	_setreg_resp_delim_fastmap,4,2  ## @setreg_resp_delim_fastmap
	.comm	_dev_name,8,3                   ## @dev_name
	.comm	_monitor_desc,4,2               ## @monitor_desc
	.comm	_baud_rate,4,2                  ## @baud_rate
	.comm	_current_monitor,8,3            ## @current_monitor
	.comm	_MO_NO_ECHO_ON_OPEN,4,2         ## @MO_NO_ECHO_ON_OPEN
L_.str.2:                               ## @.str.2
	.asciz	"EXP Open echo\n"

	.comm	_breakaddr,8,3                  ## @breakaddr
L_.str.3:                               ## @.str.3
	.asciz	"Remote target %s connected to %s\n"

	.comm	_inferior_ptid,4,2              ## @inferior_ptid
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_monitor_open                   ; -- Begin function monitor_open
	.p2align	2
_monitor_open:                          ; @monitor_open
	.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	x19, x2
	mov	x21, x1
	mov	x22, x0
	ldr	x8, [x1]
Lloh0:
	adrp	x9, _MONITOR_OPS_MAGIC@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MONITOR_OPS_MAGIC@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_2
; %bb.1:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_error
LBB0_2:
	ldr	x8, [x21, #104]
Lloh5:
	adrp	x23, _targ_ops@GOTPAGE
Lloh6:
	ldr	x23, [x23, _targ_ops@GOTPAGEOFF]
	str	x8, [x23]
	ldr	x20, [x8]
	cbnz	x22, LBB0_4
; %bb.3:
	stp	x20, x20, [sp]
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_error
LBB0_4:
	mov	x0, x19
	bl	_target_preopen
	ldr	x0, [x21, #96]
	cbz	x0, LBB0_6
; %bb.5:
Lloh9:
	adrp	x8, _register_fastmap@GOTPAGE
Lloh10:
	ldr	x8, [x8, _register_fastmap@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
Lloh12:
	adrp	x1, _register_pattern@GOTPAGE
Lloh13:
	ldr	x1, [x1, _register_pattern@GOTPAGEOFF]
	bl	_compile_pattern
LBB0_6:
	ldr	x0, [x21, #88]
	cbz	x0, LBB0_8
; %bb.7:
Lloh14:
	adrp	x8, _getmem_resp_delim_fastmap@GOTPAGE
Lloh15:
	ldr	x8, [x8, _getmem_resp_delim_fastmap@GOTPAGEOFF]
Lloh16:
	ldr	w2, [x8]
Lloh17:
	adrp	x1, _getmem_resp_delim_pattern@GOTPAGE
Lloh18:
	ldr	x1, [x1, _getmem_resp_delim_pattern@GOTPAGEOFF]
	bl	_compile_pattern
LBB0_8:
	ldr	x0, [x21, #80]
	cbz	x0, LBB0_10
; %bb.9:
Lloh19:
	adrp	x8, _setmem_resp_delim_fastmap@GOTPAGE
Lloh20:
	ldr	x8, [x8, _setmem_resp_delim_fastmap@GOTPAGEOFF]
Lloh21:
	ldr	w2, [x8]
Lloh22:
	adrp	x1, _setmem_resp_delim_pattern@GOTPAGE
Lloh23:
	ldr	x1, [x1, _setmem_resp_delim_pattern@GOTPAGEOFF]
	bl	_compile_pattern
LBB0_10:
	ldr	x0, [x21, #72]
	cbz	x0, LBB0_12
; %bb.11:
Lloh24:
	adrp	x8, _setreg_resp_delim_fastmap@GOTPAGE
Lloh25:
	ldr	x8, [x8, _setreg_resp_delim_fastmap@GOTPAGEOFF]
Lloh26:
	ldr	w2, [x8]
Lloh27:
	adrp	x1, _setreg_resp_delim_pattern@GOTPAGE
Lloh28:
	ldr	x1, [x1, _setreg_resp_delim_pattern@GOTPAGEOFF]
	bl	_compile_pattern
LBB0_12:
	ldr	x0, [x23]
	bl	_unpush_target
Lloh29:
	adrp	x24, _dev_name@GOTPAGE
Lloh30:
	ldr	x24, [x24, _dev_name@GOTPAGEOFF]
	ldr	x0, [x24]
	cbz	x0, LBB0_14
; %bb.13:
	bl	_xfree
LBB0_14:
	mov	x0, x22
	bl	_xstrdup
	str	x0, [x24]
	bl	_serial_open
Lloh31:
	adrp	x25, _monitor_desc@GOTPAGE
Lloh32:
	ldr	x25, [x25, _monitor_desc@GOTPAGEOFF]
	str	w0, [x25]
	cbnz	w0, LBB0_16
; %bb.15:
	ldr	x0, [x24]
	bl	_perror_with_name
LBB0_16:
Lloh33:
	adrp	x8, _baud_rate@GOTPAGE
Lloh34:
	ldr	x8, [x8, _baud_rate@GOTPAGEOFF]
Lloh35:
	ldr	w1, [x8]
	cmn	w1, #1
	b.eq	LBB0_19
; %bb.17:
	ldr	w0, [x25]
	bl	_serial_setbaudrate
	cbz	x0, LBB0_19
; %bb.18:
	ldr	w0, [x25]
	bl	_serial_close
	ldr	x0, [x24]
	bl	_perror_with_name
LBB0_19:
	ldr	w0, [x25]
	bl	_serial_raw
	ldr	w0, [x25]
	bl	_serial_flush_input
	ldr	w0, [x25]
	ldr	w1, [x21, #64]
	bl	_serial_setstopbits
Lloh36:
	adrp	x22, _current_monitor@GOTPAGE
Lloh37:
	ldr	x22, [x22, _current_monitor@GOTPAGEOFF]
	str	x21, [x22]
	ldr	x8, [x21, #56]
Lloh38:
	adrp	x26, _MO_NO_ECHO_ON_OPEN@GOTPAGE
Lloh39:
	ldr	x26, [x26, _MO_NO_ECHO_ON_OPEN@GOTPAGEOFF]
	cbz	x8, LBB0_22
; %bb.20:
	bl	_monitor_stop
	ldr	x8, [x22]
	ldr	w8, [x8, #8]
	ldr	w9, [x26]
	tst	w9, w8
	b.ne	LBB0_22
; %bb.21:
Lloh40:
	adrp	x0, l_.str.2@PAGE
Lloh41:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_monitor_debug
	mov	x0, #0
	mov	w1, #0
	bl	_monitor_expect_prompt
LBB0_22:
	ldr	x8, [x21, #16]
	ldr	x0, [x8]
	cbz	x0, LBB0_28
; %bb.23:
	add	x27, x8, #8
	b	LBB0_26
LBB0_24:                                ;   in Loop: Header=BB0_26 Depth=1
	bl	_monitor_printf_noecho
LBB0_25:                                ;   in Loop: Header=BB0_26 Depth=1
	mov	x0, #0
	mov	w1, #0
	bl	_monitor_expect_prompt
	ldr	x0, [x27], #8
	cbz	x0, LBB0_28
LBB0_26:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x22]
	ldr	w8, [x8, #8]
	ldr	w9, [x26]
	tst	w9, w8
	b.ne	LBB0_24
; %bb.27:                               ;   in Loop: Header=BB0_26 Depth=1
	bl	_monitor_printf
	b	LBB0_25
LBB0_28:
	ldr	w0, [x25]
	bl	_serial_flush_input
	ldr	x8, [x21, #48]
	cbz	x8, LBB0_32
; %bb.29:
	ldr	w8, [x21, #24]
	cbnz	w8, LBB0_31
; %bb.30:
	mov	w8, #8
	str	w8, [x21, #24]
LBB0_31:
	lsl	w0, w8, #2
	bl	_xmalloc
Lloh42:
	adrp	x8, _breakaddr@GOTPAGE
Lloh43:
	ldr	x8, [x8, _breakaddr@GOTPAGEOFF]
Lloh44:
	str	x0, [x8]
	ldr	w8, [x21, #24]
	lsl	w2, w8, #2
	mov	w1, #0
	bl	_memset
LBB0_32:
	ldr	x0, [x21, #32]
	cbz	x0, LBB0_34
; %bb.33:
	bl	_monitor_printf
	mov	x0, #0
	mov	w1, #0
	bl	_monitor_expect_prompt
LBB0_34:
	cbz	w19, LBB0_36
; %bb.35:
	ldr	x2, [x24]
Lloh45:
	adrp	x0, l_.str.3@PAGE
Lloh46:
	add	x0, x0, l_.str.3@PAGEOFF
	mov	x1, x20
	bl	_printf_unfiltered
LBB0_36:
	ldr	x0, [x23]
	bl	_push_target
	mov	w0, #42000
	bl	_pid_to_ptid
Lloh47:
	adrp	x8, _inferior_ptid@GOTPAGE
Lloh48:
	ldr	x8, [x8, _inferior_ptid@GOTPAGEOFF]
Lloh49:
	str	w0, [x8]
	ldr	x8, [x22]
	ldr	x0, [x8, #40]
	bl	_monitor_printf
	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
	b	_start_remote
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGot	Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh36, Lloh37
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpLdrGotStr	Lloh42, Lloh43, Lloh44
	.loh AdrpAdd	Lloh45, Lloh46
	.loh AdrpLdrGotStr	Lloh47, Lloh48, Lloh49
	.cfi_endproc
                                        ; -- End function
	.comm	_MONITOR_OPS_MAGIC,8,3          ; @MONITOR_OPS_MAGIC
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Magic number of monitor_ops struct wrong."

	.comm	_targ_ops,8,3                   ; @targ_ops
l_.str.1:                               ; @.str.1
	.asciz	"Use `target %s DEVICE-NAME' to use a serial port, or \n`target %s HOST-NAME:PORT-NUMBER' to use a network connection."

	.comm	_register_pattern,4,2           ; @register_pattern
	.comm	_register_fastmap,4,2           ; @register_fastmap
	.comm	_getmem_resp_delim_pattern,4,2  ; @getmem_resp_delim_pattern
	.comm	_getmem_resp_delim_fastmap,4,2  ; @getmem_resp_delim_fastmap
	.comm	_setmem_resp_delim_pattern,4,2  ; @setmem_resp_delim_pattern
	.comm	_setmem_resp_delim_fastmap,4,2  ; @setmem_resp_delim_fastmap
	.comm	_setreg_resp_delim_pattern,4,2  ; @setreg_resp_delim_pattern
	.comm	_setreg_resp_delim_fastmap,4,2  ; @setreg_resp_delim_fastmap
	.comm	_dev_name,8,3                   ; @dev_name
	.comm	_monitor_desc,4,2               ; @monitor_desc
	.comm	_baud_rate,4,2                  ; @baud_rate
	.comm	_current_monitor,8,3            ; @current_monitor
	.comm	_MO_NO_ECHO_ON_OPEN,4,2         ; @MO_NO_ECHO_ON_OPEN
l_.str.2:                               ; @.str.2
	.asciz	"EXP Open echo\n"

	.comm	_breakaddr,8,3                  ; @breakaddr
l_.str.3:                               ; @.str.3
	.asciz	"Remote target %s connected to %s\n"

	.comm	_inferior_ptid,4,2              ; @inferior_ptid
.subsections_via_symbols
