	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_open_serial                    ## -- Begin function open_serial
	.p2align	4, 0x90
_open_serial:                           ## @open_serial
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$48, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	movq	_O_RDWR@GOTPCREL(%rip), %rax
	movq	_O_NOCTTY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	callq	_open
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	callq	_printf
	cmpl	$-1, %ebx
	je	LBB0_10
## %bb.1:
	movl	%ebx, %edi
	callq	_isatty
	testl	%eax, %eax
	jne	LBB0_3
## %bb.2:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdx
	callq	_fprintf
	movq	_EXIT_FAILURE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_do_exit
LBB0_3:
	leaq	-56(%rbp), %rsi
	movl	%ebx, %edi
	callq	_tcgetattr
	cmpl	$-1, %eax
	je	LBB0_4
LBB0_5:
	movq	-24(%rbp), %rax
	movq	_VTIME@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	$0, (%rax,%rcx,8)
	movq	_VMIN@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	$0, (%rax,%rcx,8)
	xorps	%xmm0, %xmm0
	movq	_CS8@GOTPCREL(%rip), %rax
	movq	_CREAD@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movups	%xmm0, -40(%rbp)
	movq	_CLOCAL@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, -56(%rbp)
	movq	$0, -48(%rbp)
	movq	_B115200@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	leaq	-56(%rbp), %rdi
	callq	_cfsetispeed
	testq	%rax, %rax
	js	LBB0_7
## %bb.6:
	movl	(%r14), %esi
	leaq	-56(%rbp), %rdi
	callq	_cfsetospeed
	testq	%rax, %rax
	js	LBB0_7
LBB0_8:
	movq	_TCSAFLUSH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-56(%rbp), %rdx
	movl	%ebx, %edi
	callq	_tcsetattr
	cmpl	$-1, %eax
	je	LBB0_9
LBB0_10:
	movl	%ebx, %eax
	addq	$48, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_7:
	movl	%ebx, %edi
	callq	_open_serial.cold.2
	jmp	LBB0_8
LBB0_4:
	movl	%ebx, %edi
	callq	_open_serial.cold.3
	jmp	LBB0_5
LBB0_9:
	movl	%ebx, %edi
	callq	_open_serial.cold.1
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.p2align	4, 0x90                         ## -- Begin function open_serial.cold.1
_open_serial.cold.1:                    ## @open_serial.cold.1
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movl	%edi, %ebx
	leaq	L_.str.4(%rip), %rdi
	callq	_perror
	movq	_EXIT_FAILURE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_do_exit
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.p2align	4, 0x90                         ## -- Begin function open_serial.cold.2
_open_serial.cold.2:                    ## @open_serial.cold.2
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movl	%edi, %ebx
	leaq	L_.str.3(%rip), %rdi
	callq	_perror
	movq	_EXIT_FAILURE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_do_exit
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.p2align	4, 0x90                         ## -- Begin function open_serial.cold.3
_open_serial.cold.3:                    ## @open_serial.cold.3
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movl	%edi, %ebx
	leaq	L_.str.2(%rip), %rdi
	callq	_perror
	movq	_EXIT_FAILURE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_do_exit
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_O_RDWR,4,2                     ## @O_RDWR
	.comm	_O_NOCTTY,4,2                   ## @O_NOCTTY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"fd=%d\r\n"

	.comm	_stderr,4,2                     ## @stderr
L_.str.1:                               ## @.str.1
	.asciz	"%s is not a tty\n"

	.comm	_EXIT_FAILURE,4,2               ## @EXIT_FAILURE
L_.str.2:                               ## @.str.2
	.asciz	"Failed to get attributes of device"

	.comm	_VTIME,8,3                      ## @VTIME
	.comm	_VMIN,8,3                       ## @VMIN
	.comm	_CS8,4,2                        ## @CS8
	.comm	_CREAD,4,2                      ## @CREAD
	.comm	_CLOCAL,4,2                     ## @CLOCAL
	.comm	_B115200,4,2                    ## @B115200
L_.str.3:                               ## @.str.3
	.asciz	"Failed to set baud-rate"

	.comm	_TCSAFLUSH,4,2                  ## @TCSAFLUSH
L_.str.4:                               ## @.str.4
	.asciz	"tcsetattr()"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_open_serial                    ; -- Begin function open_serial
	.p2align	2
_open_serial:                           ; @open_serial
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x20, x0
Lloh0:
	adrp	x8, _O_RDWR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _O_RDWR@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _O_NOCTTY@GOTPAGE
Lloh4:
	ldr	x9, [x9, _O_NOCTTY@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w1, w9, w8
	bl	_open
	mov	x19, x0
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_printf
	cmn	w19, #1
	b.eq	LBB0_7
; %bb.1:
	mov	x0, x19
	bl	_isatty
	cbnz	w0, LBB0_3
; %bb.2:
Lloh8:
	adrp	x8, _stderr@GOTPAGE
Lloh9:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	bl	_fprintf
Lloh13:
	adrp	x8, _EXIT_FAILURE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EXIT_FAILURE@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_do_exit
LBB0_3:
	add	x1, sp, #8
	mov	x0, x19
	bl	_tcgetattr
	cmn	w0, #1
	b.eq	LBB0_9
LBB0_4:
	ldr	x8, [sp, #40]
Lloh16:
	adrp	x9, _VTIME@GOTPAGE
Lloh17:
	ldr	x9, [x9, _VTIME@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	str	xzr, [x8, x9, lsl #3]
Lloh19:
	adrp	x9, _VMIN@GOTPAGE
Lloh20:
	ldr	x9, [x9, _VMIN@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	str	xzr, [x8, x9, lsl #3]
	str	xzr, [sp, #32]
Lloh22:
	adrp	x8, _CS8@GOTPAGE
Lloh23:
	ldr	x8, [x8, _CS8@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
Lloh25:
	adrp	x9, _CREAD@GOTPAGE
Lloh26:
	ldr	x9, [x9, _CREAD@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh28:
	adrp	x9, _CLOCAL@GOTPAGE
Lloh29:
	ldr	x9, [x9, _CLOCAL@GOTPAGEOFF]
Lloh30:
	ldr	w9, [x9]
	orr	w8, w8, w9
	str	w8, [sp, #8]
	stp	xzr, xzr, [sp, #16]
Lloh31:
	adrp	x20, _B115200@GOTPAGE
Lloh32:
	ldr	x20, [x20, _B115200@GOTPAGEOFF]
	ldr	w1, [x20]
	add	x0, sp, #8
	bl	_cfsetispeed
	tbnz	x0, #63, LBB0_8
; %bb.5:
	ldr	w1, [x20]
	add	x0, sp, #8
	bl	_cfsetospeed
	tbnz	x0, #63, LBB0_8
LBB0_6:
Lloh33:
	adrp	x8, _TCSAFLUSH@GOTPAGE
Lloh34:
	ldr	x8, [x8, _TCSAFLUSH@GOTPAGEOFF]
Lloh35:
	ldr	w1, [x8]
	add	x2, sp, #8
	mov	x0, x19
	bl	_tcsetattr
	cmn	w0, #1
	b.eq	LBB0_10
LBB0_7:
	mov	x0, x19
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_8:
	mov	x0, x19
	bl	_open_serial.cold.2
	b	LBB0_6
LBB0_9:
	mov	x0, x19
	bl	_open_serial.cold.3
	b	LBB0_4
LBB0_10:
	mov	x0, x19
	bl	_open_serial.cold.1
	b	LBB0_7
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.p2align	2                               ; -- Begin function open_serial.cold.1
_open_serial.cold.1:                    ; @open_serial.cold.1
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh36:
	adrp	x0, l_.str.4@PAGE
Lloh37:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_perror
Lloh38:
	adrp	x8, _EXIT_FAILURE@GOTPAGE
Lloh39:
	ldr	x8, [x8, _EXIT_FAILURE@GOTPAGEOFF]
Lloh40:
	ldr	w1, [x8]
	bl	_OUTLINED_FUNCTION_1
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	b	_OUTLINED_FUNCTION_0
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpAdd	Lloh36, Lloh37
	.cfi_endproc
                                        ; -- End function
	.p2align	2                               ; -- Begin function open_serial.cold.2
_open_serial.cold.2:                    ; @open_serial.cold.2
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh41:
	adrp	x0, l_.str.3@PAGE
Lloh42:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_perror
Lloh43:
	adrp	x8, _EXIT_FAILURE@GOTPAGE
Lloh44:
	ldr	x8, [x8, _EXIT_FAILURE@GOTPAGEOFF]
Lloh45:
	ldr	w1, [x8]
	bl	_OUTLINED_FUNCTION_1
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	b	_OUTLINED_FUNCTION_0
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpAdd	Lloh41, Lloh42
	.cfi_endproc
                                        ; -- End function
	.p2align	2                               ; -- Begin function open_serial.cold.3
_open_serial.cold.3:                    ; @open_serial.cold.3
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh46:
	adrp	x0, l_.str.2@PAGE
Lloh47:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_perror
Lloh48:
	adrp	x8, _EXIT_FAILURE@GOTPAGE
Lloh49:
	ldr	x8, [x8, _EXIT_FAILURE@GOTPAGEOFF]
Lloh50:
	ldr	w1, [x8]
	bl	_OUTLINED_FUNCTION_1
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	b	_OUTLINED_FUNCTION_0
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.loh AdrpAdd	Lloh46, Lloh47
	.cfi_endproc
                                        ; -- End function
	.p2align	2                               ; -- Begin function OUTLINED_FUNCTION_0
_OUTLINED_FUNCTION_0:                   ; @OUTLINED_FUNCTION_0 Tail Call
	.cfi_startproc
; %bb.0:
	ldp	x20, x19, [sp], #32
	ret
	.cfi_endproc
                                        ; -- End function
	.p2align	2                               ; -- Begin function OUTLINED_FUNCTION_1
_OUTLINED_FUNCTION_1:                   ; @OUTLINED_FUNCTION_1 Thunk
	.cfi_startproc
; %bb.0:
	mov	x0, x19
	b	_do_exit
	.cfi_endproc
                                        ; -- End function
	.comm	_O_RDWR,4,2                     ; @O_RDWR
	.comm	_O_NOCTTY,4,2                   ; @O_NOCTTY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"fd=%d\r\n"

	.comm	_stderr,4,2                     ; @stderr
l_.str.1:                               ; @.str.1
	.asciz	"%s is not a tty\n"

	.comm	_EXIT_FAILURE,4,2               ; @EXIT_FAILURE
l_.str.2:                               ; @.str.2
	.asciz	"Failed to get attributes of device"

	.comm	_VTIME,8,3                      ; @VTIME
	.comm	_VMIN,8,3                       ; @VMIN
	.comm	_CS8,4,2                        ; @CS8
	.comm	_CREAD,4,2                      ; @CREAD
	.comm	_CLOCAL,4,2                     ; @CLOCAL
	.comm	_B115200,4,2                    ; @B115200
l_.str.3:                               ; @.str.3
	.asciz	"Failed to set baud-rate"

	.comm	_TCSAFLUSH,4,2                  ; @TCSAFLUSH
l_.str.4:                               ; @.str.4
	.asciz	"tcsetattr()"

.subsections_via_symbols
