	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bwscsbdup                      ## -- Begin function bwscsbdup
	.p2align	4, 0x90
_bwscsbdup:                             ## @bwscsbdup
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	_bwsalloc
	movq	%rax, %r15
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	testq	%r14, %r14
	je	LBB0_11
## %bb.1:
	movq	_MB_CUR_MAX@GOTPCREL(%rip), %rax
	cmpl	$1, (%rax)
	jne	LBB0_3
## %bb.2:
	movl	16(%r15), %edi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_memcpy
	jmp	LBB0_11
LBB0_3:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	leaq	-44(%rbp), %rdi
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	movl	$4, %edx
	callq	_memset
	testq	%rbx, %rbx
	je	LBB0_10
## %bb.4:
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_5 Depth=1
	movzbl	(%r12), %eax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	8(%rcx), %rcx
	movb	%al, (%rcx,%r14)
	movl	$1, %r13d
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=1
	addq	%r13, %r15
	incq	%r14
	cmpq	%rbx, %r15
	jae	LBB0_10
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	_MB_CUR_MAX@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movq	%rbx, %rsi
	subq	%r15, %rsi
	cmpq	%rax, %rsi
	cmovaeq	%rax, %rsi
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%r15), %r12
	movq	%r12, %rdi
	leaq	-44(%rbp), %rdx
	callq	_mbrlen
	movq	%rax, %r13
	addq	$2, %rax
	cmpq	$2, %rax
	jbe	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rdi
	addq	%r14, %rdi
	movq	%r12, %rsi
	movq	%r13, %rdx
	leaq	-44(%rbp), %rcx
	callq	_mbrtowc
	cmpq	$-2, %rax
	jb	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	$2, %edi
	leaq	L_.str(%rip), %rsi
	callq	_err
	jmp	LBB0_9
LBB0_10:
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	%r14, (%r15)
	movq	8(%r15), %rax
	movb	$0, (%rax,%r14)
LBB0_11:
	movq	%r15, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MB_CUR_MAX,4,2                 ## @MB_CUR_MAX
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"mbrtowc error"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bwscsbdup                      ; -- Begin function bwscsbdup
	.p2align	2
_bwscsbdup:                             ; @bwscsbdup
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x1
	mov	x21, x0
	mov	x0, x1
	bl	_bwsalloc
	mov	x19, x0
	cbz	x21, LBB0_12
; %bb.1:
Lloh0:
	adrp	x25, _MB_CUR_MAX@GOTPAGE
Lloh1:
	ldr	x25, [x25, _MB_CUR_MAX@GOTPAGEOFF]
	ldr	w8, [x25]
	cmp	w8, #1
	b.ne	LBB0_3
; %bb.2:
	ldr	w0, [x19, #16]
	mov	x1, x21
	mov	x2, x20
	bl	_memcpy
	b	LBB0_12
LBB0_3:
	add	x0, sp, #12
	mov	w1, #0
	mov	w2, #4
	bl	_memset
	cbz	x20, LBB0_10
; %bb.4:
	mov	x27, #0
	mov	x26, #0
Lloh2:
	adrp	x22, l_.str@PAGE
Lloh3:
	add	x22, x22, l_.str@PAGEOFF
	b	LBB0_7
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
	ldrb	w8, [x24]
	ldr	x9, [x19, #8]
	strb	w8, [x9, x26]
	mov	w23, #1
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	x26, x26, #1
	add	x27, x23, x27
	cmp	x27, x20
	b.hs	LBB0_11
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldrsw	x8, [x25]
	sub	x9, x20, x27
	cmp	x9, x8
	csel	x1, x9, x8, lo
	add	x24, x21, x27
	add	x2, sp, #12
	mov	x0, x24
	bl	_mbrlen
	add	x8, x0, #2
	cmp	x8, #2
	b.ls	LBB0_5
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	x23, x0
	ldr	x8, [x19, #8]
	add	x0, x8, x26
	add	x3, sp, #12
	mov	x1, x24
	mov	x2, x23
	bl	_mbrtowc
	cmn	x0, #2
	b.lo	LBB0_6
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	w0, #2
	mov	x1, x22
	bl	_err
	b	LBB0_6
LBB0_10:
	mov	x26, #0
LBB0_11:
	str	x26, [x19]
	ldr	x8, [x19, #8]
	strb	wzr, [x8, x26]
LBB0_12:
	mov	x0, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.comm	_MB_CUR_MAX,4,2                 ; @MB_CUR_MAX
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"mbrtowc error"

.subsections_via_symbols
