	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function setup_buffer
_setup_buffer:                          ## @setup_buffer
	.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
	movq	_screen_width@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_SETUPBUFFER_MIN_SCREENWIDTH@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpl	%ecx, %eax
	cmovgl	%eax, %ecx
	movq	%rdi, %r14
	movq	_setup_buffer_bufsiz@GOTPCREL(%rip), %rax
	movl	%ecx, (%rax)
	addl	%esi, %ecx
	movq	_SETUPBUFFER_REQUIRED_ADDBUFSIZ@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movslq	%ecx, %rbx
	addq	%rax, %rbx
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_calloc
	movq	%rax, %r15
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	testq	%r14, %r14
	je	LBB0_4
LBB0_3:
	movq	%r14, %rdi
	callq	_strlen
	decq	%rbx
	cmpq	%rbx, %rax
	cmovbq	%rax, %rbx
	movq	%r15, %rdi
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_memcpy
	movq	%r14, %rdi
	callq	_free
LBB0_4:
	movq	%r15, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	leaq	L_.str(%rip), %rsi
	movl	$4, %edi
	callq	_errx
	testq	%r14, %r14
	jne	LBB0_3
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.comm	_screen_width,4,2               ## @screen_width
	.comm	_setup_buffer_bufsiz,4,2        ## @setup_buffer_bufsiz
	.comm	_SETUPBUFFER_MIN_SCREENWIDTH,4,2 ## @SETUPBUFFER_MIN_SCREENWIDTH
	.comm	_SETUPBUFFER_REQUIRED_ADDBUFSIZ,4,2 ## @SETUPBUFFER_REQUIRED_ADDBUFSIZ
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"can't allocate sufficient memory"

	.no_dead_strip	_setup_buffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function setup_buffer
_setup_buffer:                          ; @setup_buffer
	.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
Lloh0:
	adrp	x8, _screen_width@GOTPAGE
Lloh1:
	ldr	x8, [x8, _screen_width@GOTPAGEOFF]
Lloh2:
	adrp	x9, _SETUPBUFFER_MIN_SCREENWIDTH@GOTPAGE
Lloh3:
	ldr	x9, [x9, _SETUPBUFFER_MIN_SCREENWIDTH@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	ldr	w9, [x9]
	cmp	w8, w9
	csel	w8, w8, w9, gt
Lloh6:
	adrp	x9, _setup_buffer_bufsiz@GOTPAGE
Lloh7:
	ldr	x9, [x9, _setup_buffer_bufsiz@GOTPAGEOFF]
Lloh8:
	str	w8, [x9]
	add	w8, w8, w1
Lloh9:
	adrp	x9, _SETUPBUFFER_REQUIRED_ADDBUFSIZ@GOTPAGE
Lloh10:
	ldr	x9, [x9, _SETUPBUFFER_REQUIRED_ADDBUFSIZ@GOTPAGEOFF]
Lloh11:
	ldrsw	x9, [x9]
	add	x21, x9, w8, sxtw
	mov	x0, x21
	mov	w1, #1
	bl	_calloc
	mov	x20, x0
	cbz	x0, LBB0_4
; %bb.1:
	cbz	x19, LBB0_3
LBB0_2:
	mov	x0, x19
	bl	_strlen
	sub	x8, x21, #1
	cmp	x0, x8
	csel	x2, x0, x8, lo
	mov	x0, x20
	mov	x1, x19
	bl	_memcpy
	mov	x0, x19
	bl	_free
LBB0_3:
	mov	x0, x20
	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_4:
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #4
	bl	_errx
	cbnz	x19, LBB0_2
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotStr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh4
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_screen_width,4,2               ; @screen_width
	.comm	_setup_buffer_bufsiz,4,2        ; @setup_buffer_bufsiz
	.comm	_SETUPBUFFER_MIN_SCREENWIDTH,4,2 ; @SETUPBUFFER_MIN_SCREENWIDTH
	.comm	_SETUPBUFFER_REQUIRED_ADDBUFSIZ,4,2 ; @SETUPBUFFER_REQUIRED_ADDBUFSIZ
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"can't allocate sufficient memory"

	.no_dead_strip	_setup_buffer
.subsections_via_symbols
