	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ttyname                        ## -- Begin function ttyname
	.p2align	4, 0x90
_ttyname:                               ## @ttyname
	.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
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	xorl	%eax, %eax
	callq	_thr_main
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	movq	_ttyname_buf@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
LBB0_2:
	movl	%r14d, %edi
	movq	%rbx, %rsi
	movl	$8, %edx
	callq	_ttyname_r
	movq	%rax, %rcx
	xorl	%eax, %eax
	testq	%rcx, %rcx
	cmoveq	%rbx, %rax
LBB0_10:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	_ttyname_keycreate@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ttyname_init_once@GOTPCREL(%rip), %rdi
	callq	_thr_once
	movq	%rax, %rcx
	xorl	%eax, %eax
	testq	%rcx, %rcx
	jne	LBB0_10
## %bb.4:
	movq	_ttyname_keycreated@GOTPCREL(%rip), %rcx
	cmpl	$0, (%rcx)
	je	LBB0_10
## %bb.5:
	movq	_ttyname_key@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	callq	_thr_getspecific
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_2
## %bb.6:
	movl	$8, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_9
## %bb.7:
	movq	%rax, %rbx
	movl	(%r15), %edi
	movq	%rax, %rsi
	callq	_thr_setspecific
	testq	%rax, %rax
	je	LBB0_2
## %bb.8:
	movq	%rbx, %rdi
	callq	_free
LBB0_9:
	xorl	%eax, %eax
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_ttyname_buf,8,3                ## @ttyname_buf
	.comm	_ttyname_init_once,4,2          ## @ttyname_init_once
	.comm	_ttyname_keycreate,4,2          ## @ttyname_keycreate
	.comm	_ttyname_keycreated,4,2         ## @ttyname_keycreated
	.comm	_ttyname_key,4,2                ## @ttyname_key
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ttyname                        ; -- Begin function ttyname
	.p2align	2
_ttyname:                               ; @ttyname
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x19, x0
	bl	_thr_main
	cbz	x0, LBB0_3
; %bb.1:
Lloh0:
	adrp	x8, _ttyname_buf@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ttyname_buf@GOTPAGEOFF]
Lloh2:
	ldr	x20, [x8]
LBB0_2:
	mov	x0, x19
	mov	x1, x20
	mov	w2, #8
	bl	_ttyname_r
	cmp	x0, #0
	csel	x0, x20, xzr, eq
	b	LBB0_5
LBB0_3:
Lloh3:
	adrp	x8, _ttyname_keycreate@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ttyname_keycreate@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
Lloh6:
	adrp	x0, _ttyname_init_once@GOTPAGE
Lloh7:
	ldr	x0, [x0, _ttyname_init_once@GOTPAGEOFF]
	bl	_thr_once
Lloh8:
	adrp	x8, _ttyname_keycreated@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ttyname_keycreated@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	cmp	x0, #0
	ccmp	w8, #0, #4, eq
	b.ne	LBB0_6
LBB0_4:
	mov	x0, #0
LBB0_5:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_6:
Lloh11:
	adrp	x21, _ttyname_key@GOTPAGE
Lloh12:
	ldr	x21, [x21, _ttyname_key@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_thr_getspecific
	mov	x20, x0
	cbnz	x0, LBB0_2
; %bb.7:
	mov	w0, #8
	bl	_malloc
	cbz	x0, LBB0_5
; %bb.8:
	mov	x20, x0
	ldr	w0, [x21]
	mov	x1, x20
	bl	_thr_setspecific
	cbz	x0, LBB0_2
; %bb.9:
	mov	x0, x20
	bl	_free
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_ttyname_buf,8,3                ; @ttyname_buf
	.comm	_ttyname_init_once,4,2          ; @ttyname_init_once
	.comm	_ttyname_keycreate,4,2          ; @ttyname_keycreate
	.comm	_ttyname_keycreated,4,2         ; @ttyname_keycreated
	.comm	_ttyname_key,4,2                ; @ttyname_key
.subsections_via_symbols
