	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	___gets_chk                     ## -- Begin function __gets_chk
	.p2align	4, 0x90
___gets_chk:                            ## @__gets_chk
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	_INT_MAX@GOTPCREL(%rip), %rax
	cmpq	%rsi, (%rax)
	jbe	LBB0_16
## %bb.1:
	movq	%rsi, %rbx
	leaq	1(%rsi), %rdi
	cmpq	$8192, %rsi                     ## imm = 0x2000
	ja	LBB0_3
## %bb.2:
	callq	_alloca
	jmp	LBB0_4
LBB0_3:
	callq	_malloc
LBB0_4:
	movq	%rax, %r15
	testq	%rax, %rax
	je	LBB0_16
## %bb.5:
	leal	1(%rbx), %esi
	movq	_stdin@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_fgets
	testq	%rax, %rax
	je	LBB0_6
## %bb.7:
	movq	%r15, %rdi
	callq	_strlen
	testq	%rax, %rax
	je	LBB0_8
## %bb.9:
	leaq	-1(%rax), %r12
	cmpb	$10, -1(%r15,%rax)
	cmovneq	%rax, %r12
	cmpq	%rbx, %r12
	jne	LBB0_12
LBB0_11:
	xorl	%eax, %eax
	callq	___chk_fail
LBB0_12:
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	callq	_memcpy
	movb	$0, (%r14,%r12)
	cmpq	$8193, %rbx                     ## imm = 0x2001
	jb	LBB0_15
LBB0_14:
	movq	%r15, %rdi
	callq	_free
LBB0_15:
	movq	%r14, %rax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_gets                           ## TAILCALL
LBB0_6:
	xorl	%r14d, %r14d
	cmpq	$8193, %rbx                     ## imm = 0x2001
	jae	LBB0_14
	jmp	LBB0_15
LBB0_8:
	xorl	%r12d, %r12d
	cmpq	%rbx, %r12
	je	LBB0_11
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_INT_MAX,8,3                    ## @INT_MAX
	.comm	_stdin,4,2                      ## @stdin
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	___gets_chk                     ; -- Begin function __gets_chk
	.p2align	2
___gets_chk:                            ; @__gets_chk
	.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, _INT_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _INT_MAX@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, x1
	b.ls	LBB0_11
; %bb.1:
	mov	x20, x1
	add	x0, x1, #1
	cmp	x1, #2, lsl #12                 ; =8192
	b.hi	LBB0_10
; %bb.2:
	bl	_alloca
	mov	x21, x0
	cbz	x0, LBB0_11
LBB0_3:
	add	w1, w20, #1
Lloh3:
	adrp	x8, _stdin@GOTPAGE
Lloh4:
	ldr	x8, [x8, _stdin@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	mov	x0, x21
	bl	_fgets
	cbz	x0, LBB0_12
; %bb.4:
	mov	x0, x21
	bl	_strlen
	cbz	x0, LBB0_13
; %bb.5:
	sub	x8, x0, #1
	ldrb	w9, [x21, x8]
	cmp	w9, #10
	csel	x22, x8, x0, eq
	cmp	x22, x20
	b.ne	LBB0_7
LBB0_6:
	bl	___chk_fail
LBB0_7:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	bl	_memcpy
	strb	wzr, [x19, x22]
	cmp	x20, #2, lsl #12                ; =8192
	b.ls	LBB0_9
LBB0_8:
	mov	x0, x21
	bl	_free
LBB0_9:
	mov	x0, x19
	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_10:
	bl	_malloc
	mov	x21, x0
	cbnz	x0, LBB0_3
LBB0_11:
	mov	x0, x19
	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
	b	_gets
LBB0_12:
	mov	x19, #0
	cmp	x20, #2, lsl #12                ; =8192
	b.hi	LBB0_8
	b	LBB0_9
LBB0_13:
	mov	x22, #0
	cmp	x22, x20
	b.eq	LBB0_6
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_INT_MAX,8,3                    ; @INT_MAX
	.comm	_stdin,4,2                      ; @stdin
.subsections_via_symbols
