	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tuklib_open_stdxxx             ## -- Begin function tuklib_open_stdxxx
	.p2align	4, 0x90
_tuklib_open_stdxxx:                    ## @tuklib_open_stdxxx
	.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
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%edi, %r14d
	movq	_F_GETFD@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	xorl	%edi, %edi
	callq	_fcntl
	cmpl	$-1, %eax
	jne	LBB0_6
## %bb.1:
	movq	_errno@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_EBADF@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
## %bb.2:
	movq	_O_NOCTTY@GOTPCREL(%rip), %rax
	movq	_O_WRONLY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	leaq	L_.str(%rip), %rdi
	callq	_open
	testl	%eax, %eax
	jne	LBB0_3
LBB0_6:
	movl	(%rbx), %esi
	movl	$1, %edi
	callq	_fcntl
	cmpl	$-1, %eax
	jne	LBB0_9
## %bb.7:
	movq	_errno@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_EBADF@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.8:
	movq	_O_NOCTTY@GOTPCREL(%rip), %rax
	movq	_O_RDONLY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	leaq	L_.str(%rip), %rdi
	callq	_open
	cmpl	$1, %eax
	jne	LBB0_3
LBB0_9:
	movl	(%rbx), %esi
	movl	$2, %edi
	callq	_fcntl
	cmpl	$-1, %eax
	jne	LBB0_12
## %bb.10:
	movq	_errno@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_EBADF@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_12
## %bb.11:
	movq	_O_NOCTTY@GOTPCREL(%rip), %rax
	movq	_O_RDONLY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	leaq	L_.str(%rip), %rdi
	callq	_open
	cmpl	$2, %eax
	jne	LBB0_3
LBB0_12:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_3:
	cmpl	$-1, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %edi
	callq	_close
LBB0_5:
	movl	%r14d, %edi
	callq	_exit
	.cfi_endproc
                                        ## -- End function
	.comm	_F_GETFD,4,2                    ## @F_GETFD
	.comm	_errno,8,3                      ## @errno
	.comm	_EBADF,8,3                      ## @EBADF
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"/dev/null"

	.comm	_O_NOCTTY,4,2                   ## @O_NOCTTY
	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tuklib_open_stdxxx             ; -- Begin function tuklib_open_stdxxx
	.p2align	2
_tuklib_open_stdxxx:                    ; @tuklib_open_stdxxx
	.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
Lloh0:
	adrp	x20, _F_GETFD@GOTPAGE
Lloh1:
	ldr	x20, [x20, _F_GETFD@GOTPAGEOFF]
	ldr	w1, [x20]
	mov	w0, #0
	bl	_fcntl
	cmn	w0, #1
	b.ne	LBB0_3
; %bb.1:
Lloh2:
	adrp	x8, _errno@GOTPAGE
Lloh3:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
Lloh5:
	adrp	x9, _EBADF@GOTPAGE
Lloh6:
	ldr	x9, [x9, _EBADF@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.2:
Lloh8:
	adrp	x8, _O_NOCTTY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _O_NOCTTY@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
Lloh11:
	adrp	x9, _O_WRONLY@GOTPAGE
Lloh12:
	ldr	x9, [x9, _O_WRONLY@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w1, w9, w8
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_open
	cbnz	w0, LBB0_10
LBB0_3:
	ldr	w1, [x20]
	mov	w0, #1
	bl	_fcntl
	cmn	w0, #1
	b.ne	LBB0_6
; %bb.4:
Lloh16:
	adrp	x8, _errno@GOTPAGE
Lloh17:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh18:
	ldr	x8, [x8]
Lloh19:
	adrp	x9, _EBADF@GOTPAGE
Lloh20:
	ldr	x9, [x9, _EBADF@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_6
; %bb.5:
Lloh22:
	adrp	x8, _O_NOCTTY@GOTPAGE
Lloh23:
	ldr	x8, [x8, _O_NOCTTY@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
Lloh25:
	adrp	x9, _O_RDONLY@GOTPAGE
Lloh26:
	ldr	x9, [x9, _O_RDONLY@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	orr	w1, w9, w8
Lloh28:
	adrp	x0, l_.str@PAGE
Lloh29:
	add	x0, x0, l_.str@PAGEOFF
	bl	_open
	cmp	w0, #1
	b.ne	LBB0_10
LBB0_6:
	ldr	w1, [x20]
	mov	w0, #2
	bl	_fcntl
	cmn	w0, #1
	b.ne	LBB0_9
; %bb.7:
Lloh30:
	adrp	x8, _errno@GOTPAGE
Lloh31:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh32:
	ldr	x8, [x8]
Lloh33:
	adrp	x9, _EBADF@GOTPAGE
Lloh34:
	ldr	x9, [x9, _EBADF@GOTPAGEOFF]
Lloh35:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_9
; %bb.8:
Lloh36:
	adrp	x8, _O_NOCTTY@GOTPAGE
Lloh37:
	ldr	x8, [x8, _O_NOCTTY@GOTPAGEOFF]
Lloh38:
	ldr	w8, [x8]
Lloh39:
	adrp	x9, _O_RDONLY@GOTPAGE
Lloh40:
	ldr	x9, [x9, _O_RDONLY@GOTPAGEOFF]
Lloh41:
	ldr	w9, [x9]
	orr	w1, w9, w8
Lloh42:
	adrp	x0, l_.str@PAGE
Lloh43:
	add	x0, x0, l_.str@PAGEOFF
	bl	_open
	cmp	w0, #2
	b.ne	LBB0_10
LBB0_9:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_10:
	cmn	w0, #1
	b.eq	LBB0_12
; %bb.11:
	bl	_close
LBB0_12:
	mov	x0, x19
	bl	_exit
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_F_GETFD,4,2                    ; @F_GETFD
	.comm	_errno,8,3                      ; @errno
	.comm	_EBADF,8,3                      ; @EBADF
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"/dev/null"

	.comm	_O_NOCTTY,4,2                   ; @O_NOCTTY
	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
.subsections_via_symbols
