	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_openterm                       ## -- Begin function openterm
	.p2align	4, 0x90
_openterm:                              ## @openterm
	.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	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	_debug@GOTPCREL(%rip), %r15
	cmpq	$0, (%r15)
	je	LBB0_2
## %bb.1:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_fprintf
LBB0_2:
	movq	_O_RDONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$511, %edx                      ## imm = 0x1FF
	callq	_open
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	cmpq	$0, (%r15)
	jne	LBB0_5
	jmp	LBB0_7
LBB0_3:
	leaq	L_.str.1(%rip), %rdi
	leaq	L_.str.2(%rip), %rdx
	movq	%rbx, %rsi
	callq	_error
	cmpq	$0, (%r15)
	je	LBB0_7
LBB0_5:
	movq	_stderr@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	leaq	L_.str.3(%rip), %rsi
	callq	_fprintf
	cmpq	$0, (%r15)
	je	LBB0_7
## %bb.6:
	movl	(%rbx), %edi
	leaq	L_.str.4(%rip), %rsi
	callq	_fprintf
LBB0_7:
	movq	_TIOCEXCL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	xorl	%edx, %edx
	callq	_ioctl
	testq	%rax, %rax
	js	LBB0_8
## %bb.9:
	cmpq	$0, (%r15)
	je	LBB0_10
LBB0_11:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.6(%rip), %rsi
	callq	_fprintf
	cmpq	$0, (%r15)
	sete	%al
	jmp	LBB0_12
LBB0_8:
	leaq	L_.str.5(%rip), %rdi
	leaq	L_.str.2(%rip), %rdx
	movq	%rdx, %rsi
	callq	_error
	cmpq	$0, (%r15)
	jne	LBB0_11
LBB0_10:
	movb	$1, %al
LBB0_12:
	movq	_B300@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -32(%rbp)
	movl	%ecx, -28(%rbp)
	xorps	%xmm0, %xmm0
	movups	%xmm0, -48(%rbp)
	movq	_EVENP@GOTPCREL(%rip), %rcx
	movq	_ODDP@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movq	_RAW@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edx
	movl	%edx, -56(%rbp)
	testb	%al, %al
	jne	LBB0_14
## %bb.13:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.7(%rip), %rsi
	callq	_fprintf
LBB0_14:
	movq	_TIOCSETP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-56(%rbp), %rdx
	movl	%r14d, %edi
	callq	_ioctl
	testq	%rax, %rax
	js	LBB0_15
## %bb.16:
	cmpq	$0, (%r15)
	je	LBB0_18
LBB0_17:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.6(%rip), %rsi
	callq	_fprintf
LBB0_18:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	leaq	L_.str.8(%rip), %rdi
	leaq	L_.str.2(%rip), %rdx
	movq	%rdx, %rsi
	callq	_error
	cmpq	$0, (%r15)
	jne	LBB0_17
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_debug,8,3                      ## @debug
	.comm	_stderr,4,2                     ## @stderr
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Doing open..."

	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
L_.str.1:                               ## @.str.1
	.asciz	"open(%s)"

L_.str.2:                               ## @.str.2
	.space	1

L_.str.3:                               ## @.str.3
	.asciz	"open okay\n"

L_.str.4:                               ## @.str.4
	.asciz	"Setting exclusive use..."

	.comm	_TIOCEXCL,4,2                   ## @TIOCEXCL
L_.str.5:                               ## @.str.5
	.asciz	"ioctl(TIOCEXCL)"

L_.str.6:                               ## @.str.6
	.asciz	"done\n"

	.comm	_B300,4,2                       ## @B300
	.comm	_EVENP,4,2                      ## @EVENP
	.comm	_ODDP,4,2                       ## @ODDP
	.comm	_RAW,4,2                        ## @RAW
L_.str.7:                               ## @.str.7
	.asciz	"Setting baud rate et al..."

	.comm	_TIOCSETP,4,2                   ## @TIOCSETP
L_.str.8:                               ## @.str.8
	.asciz	"ioctl(TIOCSETP, raw)"

	.comm	_CHULDISC,4,2                   ## @CHULDISC
	.comm	_I_POP,4,2                      ## @I_POP
	.comm	_I_PUSH,4,2                     ## @I_PUSH
	.comm	_TIOCSETD,4,2                   ## @TIOCSETD
	.comm	_usechuldisc,8,3                ## @usechuldisc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_openterm                       ; -- Begin function openterm
	.p2align	2
_openterm:                              ; @openterm
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x20, x0
Lloh0:
	adrp	x22, _debug@GOTPAGE
Lloh1:
	ldr	x22, [x22, _debug@GOTPAGEOFF]
	ldr	x8, [x22]
Lloh2:
	adrp	x21, _stderr@GOTPAGE
Lloh3:
	ldr	x21, [x21, _stderr@GOTPAGEOFF]
	cbz	x8, LBB0_2
; %bb.1:
	ldr	w0, [x21]
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	bl	_fprintf
LBB0_2:
Lloh6:
	adrp	x8, _O_RDONLY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _O_RDONLY@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #511
	bl	_open
	mov	x19, x0
	tbnz	w0, #31, LBB0_4
; %bb.3:
	ldr	x8, [x22]
	cbnz	x8, LBB0_5
	b	LBB0_7
LBB0_4:
Lloh9:
	adrp	x0, l_.str.1@PAGE
Lloh10:
	add	x0, x0, l_.str.1@PAGEOFF
Lloh11:
	adrp	x2, l_.str.2@PAGE
Lloh12:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x1, x20
	bl	_error
	ldr	x8, [x22]
	cbz	x8, LBB0_7
LBB0_5:
	ldr	w0, [x21]
Lloh13:
	adrp	x1, l_.str.3@PAGE
Lloh14:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_fprintf
	ldr	x8, [x22]
	cbz	x8, LBB0_7
; %bb.6:
	ldr	w0, [x21]
Lloh15:
	adrp	x1, l_.str.4@PAGE
Lloh16:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_fprintf
LBB0_7:
Lloh17:
	adrp	x8, _TIOCEXCL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _TIOCEXCL@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, #0
	bl	_ioctl
	tbnz	x0, #63, LBB0_10
; %bb.8:
	ldr	x8, [x22]
	cbz	x8, LBB0_11
LBB0_9:
	ldr	w0, [x21]
Lloh20:
	adrp	x1, l_.str.6@PAGE
Lloh21:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_fprintf
	ldr	x8, [x22]
	cmp	x8, #0
	cset	w8, eq
	b	LBB0_12
LBB0_10:
Lloh22:
	adrp	x0, l_.str.5@PAGE
Lloh23:
	add	x0, x0, l_.str.5@PAGEOFF
Lloh24:
	adrp	x1, l_.str.2@PAGE
Lloh25:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x1
	bl	_error
	ldr	x8, [x22]
	cbnz	x8, LBB0_9
LBB0_11:
	mov	w8, #1
LBB0_12:
Lloh26:
	adrp	x9, _B300@GOTPAGE
Lloh27:
	ldr	x9, [x9, _B300@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	stp	w9, w9, [sp, #24]
	stp	xzr, xzr, [sp, #8]
Lloh29:
	adrp	x9, _EVENP@GOTPAGE
Lloh30:
	ldr	x9, [x9, _EVENP@GOTPAGEOFF]
Lloh31:
	ldr	w9, [x9]
Lloh32:
	adrp	x10, _ODDP@GOTPAGE
Lloh33:
	ldr	x10, [x10, _ODDP@GOTPAGEOFF]
Lloh34:
	ldr	w10, [x10]
	orr	w9, w10, w9
Lloh35:
	adrp	x10, _RAW@GOTPAGE
Lloh36:
	ldr	x10, [x10, _RAW@GOTPAGEOFF]
Lloh37:
	ldr	w10, [x10]
	orr	w9, w9, w10
	str	w9, [sp]
	tbnz	w8, #0, LBB0_14
; %bb.13:
	ldr	w0, [x21]
Lloh38:
	adrp	x1, l_.str.7@PAGE
Lloh39:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_fprintf
LBB0_14:
Lloh40:
	adrp	x8, _TIOCSETP@GOTPAGE
Lloh41:
	ldr	x8, [x8, _TIOCSETP@GOTPAGEOFF]
Lloh42:
	ldr	w1, [x8]
	mov	x2, sp
	mov	x0, x19
	bl	_ioctl
	tbnz	x0, #63, LBB0_18
; %bb.15:
	ldr	x8, [x22]
	cbz	x8, LBB0_17
LBB0_16:
	ldr	w0, [x21]
Lloh43:
	adrp	x1, l_.str.6@PAGE
Lloh44:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_fprintf
LBB0_17:
	mov	x0, x19
	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
	add	sp, sp, #80
	ret
LBB0_18:
Lloh45:
	adrp	x0, l_.str.8@PAGE
Lloh46:
	add	x0, x0, l_.str.8@PAGEOFF
Lloh47:
	adrp	x1, l_.str.2@PAGE
Lloh48:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x1
	bl	_error
	ldr	x8, [x22]
	cbnz	x8, LBB0_16
	b	LBB0_17
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpAdd	Lloh45, Lloh46
	.cfi_endproc
                                        ; -- End function
	.comm	_debug,8,3                      ; @debug
	.comm	_stderr,4,2                     ; @stderr
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Doing open..."

	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
l_.str.1:                               ; @.str.1
	.asciz	"open(%s)"

l_.str.2:                               ; @.str.2
	.space	1

l_.str.3:                               ; @.str.3
	.asciz	"open okay\n"

l_.str.4:                               ; @.str.4
	.asciz	"Setting exclusive use..."

	.comm	_TIOCEXCL,4,2                   ; @TIOCEXCL
l_.str.5:                               ; @.str.5
	.asciz	"ioctl(TIOCEXCL)"

l_.str.6:                               ; @.str.6
	.asciz	"done\n"

	.comm	_B300,4,2                       ; @B300
	.comm	_EVENP,4,2                      ; @EVENP
	.comm	_ODDP,4,2                       ; @ODDP
	.comm	_RAW,4,2                        ; @RAW
l_.str.7:                               ; @.str.7
	.asciz	"Setting baud rate et al..."

	.comm	_TIOCSETP,4,2                   ; @TIOCSETP
l_.str.8:                               ; @.str.8
	.asciz	"ioctl(TIOCSETP, raw)"

	.comm	_CHULDISC,4,2                   ; @CHULDISC
	.comm	_I_POP,4,2                      ; @I_POP
	.comm	_I_PUSH,4,2                     ; @I_PUSH
	.comm	_TIOCSETD,4,2                   ; @TIOCSETD
	.comm	_usechuldisc,8,3                ; @usechuldisc
.subsections_via_symbols
