	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ocd_open                       ## -- Begin function ocd_open
	.p2align	4, 0x90
_ocd_open:                              ## @ocd_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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %rbx
	movl	%esi, %r14d
	movq	%rdi, %r15
	movl	%edx, -36(%rbp)
	testq	%rdi, %rdi
	jne	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_error
LBB0_2:
	movl	%r14d, %edi
	callq	_target_preopen
	movq	_current_ops@GOTPCREL(%rip), %r12
	movq	%rbx, (%r12)
	movq	%rbx, %rdi
	callq	_unpush_target
	movq	%r15, %rdi
	callq	_serial_open
	movq	_ocd_desc@GOTPCREL(%rip), %rbx
	movl	%eax, (%rbx)
	testl	%eax, %eax
	jne	LBB0_4
## %bb.3:
	movq	%r15, %rdi
	callq	_perror_with_name
LBB0_4:
	movq	_baud_rate@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	cmpl	$-1, %esi
	je	LBB0_7
## %bb.5:
	movl	(%rbx), %edi
	callq	_serial_setbaudrate
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movl	(%rbx), %edi
	callq	_serial_close
	movq	%r15, %rdi
	callq	_perror_with_name
LBB0_7:
	movl	(%rbx), %edi
	callq	_serial_raw
	movl	(%rbx), %edi
	callq	_serial_flush_input
	testl	%r14d, %r14d
	je	LBB0_9
## %bb.8:
	leaq	L_.str.1(%rip), %rdi
	callq	_puts_filtered
	movq	%r15, %rdi
	callq	_puts_filtered
	leaq	L_.str.2(%rip), %rdi
	callq	_puts_filtered
LBB0_9:
	movq	(%r12), %rdi
	callq	_push_target
	movl	$42000, %edi                    ## imm = 0xA410
	callq	_pid_to_ptid
	movq	_inferior_ptid@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movq	_ocd_start_remote@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_RETURN_MASK_ALL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	L_.str.3(%rip), %rdx
	leaq	-36(%rbp), %rsi
	callq	_catch_errors
	testl	%eax, %eax
	jne	LBB0_11
## %bb.10:
	xorl	%eax, %eax
	callq	_pop_target
	leaq	L_.str.4(%rip), %rdi
	callq	_error
LBB0_11:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"To open an OCD connection, you need to specify the\ndevice the OCD device is attached to (e.g. /dev/ttya)."

	.comm	_current_ops,8,3                ## @current_ops
	.comm	_ocd_desc,4,2                   ## @ocd_desc
	.comm	_baud_rate,4,2                  ## @baud_rate
L_.str.1:                               ## @.str.1
	.asciz	"Remote target wiggler connected to "

L_.str.2:                               ## @.str.2
	.asciz	"\n"

	.comm	_inferior_ptid,4,2              ## @inferior_ptid
	.comm	_ocd_start_remote,4,2           ## @ocd_start_remote
L_.str.3:                               ## @.str.3
	.asciz	"Couldn't establish connection to remote target\n"

	.comm	_RETURN_MASK_ALL,4,2            ## @RETURN_MASK_ALL
L_.str.4:                               ## @.str.4
	.asciz	"Failed to connect to OCD."

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ocd_open                       ; -- Begin function ocd_open
	.p2align	2
_ocd_open:                              ; @ocd_open
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x21, x3
	mov	x20, x1
	mov	x19, x0
	str	w2, [sp, #12]
	cbnz	x0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_error
LBB0_2:
	mov	x0, x20
	bl	_target_preopen
Lloh2:
	adrp	x22, _current_ops@GOTPAGE
Lloh3:
	ldr	x22, [x22, _current_ops@GOTPAGEOFF]
	str	x21, [x22]
	mov	x0, x21
	bl	_unpush_target
	mov	x0, x19
	bl	_serial_open
Lloh4:
	adrp	x21, _ocd_desc@GOTPAGE
Lloh5:
	ldr	x21, [x21, _ocd_desc@GOTPAGEOFF]
	str	w0, [x21]
	cbnz	w0, LBB0_4
; %bb.3:
	mov	x0, x19
	bl	_perror_with_name
LBB0_4:
Lloh6:
	adrp	x8, _baud_rate@GOTPAGE
Lloh7:
	ldr	x8, [x8, _baud_rate@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	cmn	w1, #1
	b.eq	LBB0_7
; %bb.5:
	ldr	w0, [x21]
	bl	_serial_setbaudrate
	cbz	x0, LBB0_7
; %bb.6:
	ldr	w0, [x21]
	bl	_serial_close
	mov	x0, x19
	bl	_perror_with_name
LBB0_7:
	ldr	w0, [x21]
	bl	_serial_raw
	ldr	w0, [x21]
	bl	_serial_flush_input
	cbz	w20, LBB0_9
; %bb.8:
Lloh9:
	adrp	x0, l_.str.1@PAGE
Lloh10:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_puts_filtered
	mov	x0, x19
	bl	_puts_filtered
Lloh11:
	adrp	x0, l_.str.2@PAGE
Lloh12:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_puts_filtered
LBB0_9:
	ldr	x0, [x22]
	bl	_push_target
	mov	w0, #42000
	bl	_pid_to_ptid
Lloh13:
	adrp	x8, _inferior_ptid@GOTPAGE
Lloh14:
	ldr	x8, [x8, _inferior_ptid@GOTPAGEOFF]
Lloh15:
	str	w0, [x8]
Lloh16:
	adrp	x8, _ocd_start_remote@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ocd_start_remote@GOTPAGEOFF]
Lloh18:
	ldr	w0, [x8]
Lloh19:
	adrp	x8, _RETURN_MASK_ALL@GOTPAGE
Lloh20:
	ldr	x8, [x8, _RETURN_MASK_ALL@GOTPAGEOFF]
Lloh21:
	ldr	w3, [x8]
Lloh22:
	adrp	x2, l_.str.3@PAGE
Lloh23:
	add	x2, x2, l_.str.3@PAGEOFF
	add	x1, sp, #12
	bl	_catch_errors
	cbnz	w0, LBB0_11
; %bb.10:
	bl	_pop_target
Lloh24:
	adrp	x0, l_.str.4@PAGE
Lloh25:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_error
LBB0_11:
	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
	add	sp, sp, #64
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotStr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"To open an OCD connection, you need to specify the\ndevice the OCD device is attached to (e.g. /dev/ttya)."

	.comm	_current_ops,8,3                ; @current_ops
	.comm	_ocd_desc,4,2                   ; @ocd_desc
	.comm	_baud_rate,4,2                  ; @baud_rate
l_.str.1:                               ; @.str.1
	.asciz	"Remote target wiggler connected to "

l_.str.2:                               ; @.str.2
	.asciz	"\n"

	.comm	_inferior_ptid,4,2              ; @inferior_ptid
	.comm	_ocd_start_remote,4,2           ; @ocd_start_remote
l_.str.3:                               ; @.str.3
	.asciz	"Couldn't establish connection to remote target\n"

	.comm	_RETURN_MASK_ALL,4,2            ; @RETURN_MASK_ALL
l_.str.4:                               ; @.str.4
	.asciz	"Failed to connect to OCD."

.subsections_via_symbols
