	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_refs_shorten_unambiguous_ref   ## -- Begin function refs_shorten_unambiguous_ref
	.p2align	4, 0x90
_refs_shorten_unambiguous_ref:          ## @refs_shorten_unambiguous_ref
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, -64(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r14
	movq	%rdi, -104(%rbp)                ## 8-byte Spill
	movq	_STRBUF_INIT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)
	cmpl	$0, _refs_shorten_unambiguous_ref.nr_rules(%rip)
	jne	LBB0_10
## %bb.1:
	movl	$0, _refs_shorten_unambiguous_ref.nr_rules(%rip)
	movq	_ref_rev_parse_rules@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	movq	(%rax), %rdi
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.3:
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	callq	_strlen
	cltq
	addq	%rax, %r13
	decq	%r13
	movslq	_refs_shorten_unambiguous_ref.nr_rules(%rip), %rax
	leaq	1(%rax), %rsi
	movl	%esi, _refs_shorten_unambiguous_ref.nr_rules(%rip)
	movq	(%rbx), %rcx
	movq	8(%rcx,%rax,8), %rdi
	testq	%rdi, %rdi
	jne	LBB0_4
	jmp	LBB0_5
LBB0_2:
	xorl	%esi, %esi
	xorl	%r13d, %r13d
LBB0_5:
	movl	$8, %edi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_st_mult
	movl	%eax, %edi
	movq	%r13, %rsi
	callq	_st_add
	movl	%eax, %edi
	callq	_xmalloc
	movq	%rax, _refs_shorten_unambiguous_ref.scanf_fmts(%rip)
	movl	_refs_shorten_unambiguous_ref.nr_rules(%rip), %eax
	testl	%eax, %eax
	jle	LBB0_9
## %bb.6:
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	xorl	%ebx, %ebx
	leaq	L_.str(%rip), %r14
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%edi, %edi
	movq	%r13, %r12
	subq	%r15, %r12
	seta	%dil
	callq	_assert
	movq	_refs_shorten_unambiguous_ref.scanf_fmts(%rip), %rax
	movslq	_refs_shorten_unambiguous_ref.nr_rules(%rip), %rcx
	leaq	(%rax,%rcx,8), %rdi
	addq	%r15, %rdi
	movq	%rdi, (%rax,%rbx,8)
	movq	_ref_rev_parse_rules@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rax,%rbx,8), %rdx
	movq	%r12, %rsi
	movl	$2, %ecx
	movq	%r14, %r8
	callq	_xsnprintf
	addq	%rax, %r15
	incq	%r15
	incq	%rbx
	movslq	_refs_shorten_unambiguous_ref.nr_rules(%rip), %rax
	cmpq	%rax, %rbx
	jl	LBB0_7
## %bb.8:
	movq	-56(%rbp), %r14                 ## 8-byte Reload
LBB0_9:
	testl	%eax, %eax
	je	LBB0_26
LBB0_10:
	movq	%r14, %rdi
	callq	_xstrdup
	movq	%rax, %rbx
	movl	_refs_shorten_unambiguous_ref.nr_rules(%rip), %eax
	cmpl	$2, %eax
	jl	LBB0_19
## %bb.11:
	leal	-1(%rax), %r15d
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_12
LBB0_16:                                ##   in Loop: Header=BB0_12 Depth=1
	xorl	%r12d, %r12d
LBB0_17:                                ##   in Loop: Header=BB0_12 Depth=1
	cmpl	-60(%rbp), %r12d                ## 4-byte Folded Reload
	je	LBB0_24
LBB0_18:                                ##   in Loop: Header=BB0_12 Depth=1
	decl	%r15d
	cmpq	$2, -88(%rbp)                   ## 8-byte Folded Reload
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	jle	LBB0_19
LBB0_12:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_21 Depth 2
	movl	%r15d, %r15d
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	leaq	-1(%rax), %rcx
	movq	_refs_shorten_unambiguous_ref.scanf_fmts(%rip), %rax
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	movl	%ecx, %ecx
	movq	(%rax,%rcx,8), %rsi
	movq	%r14, %rdi
	movq	%rbx, %rdx
	callq	_sscanf
	cmpl	$1, %eax
	jne	LBB0_18
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	%rbx, %rdi
	callq	_strlen
	movl	%eax, -68(%rbp)                 ## 4-byte Spill
	movq	-80(%rbp), %rax                 ## 8-byte Reload
                                        ## kill: def $eax killed $eax killed $rax
	cmpl	$0, -64(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=1
	movl	_refs_shorten_unambiguous_ref.nr_rules(%rip), %eax
LBB0_15:                                ##   in Loop: Header=BB0_12 Depth=1
	testl	%eax, %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	jle	LBB0_16
## %bb.20:                              ##   in Loop: Header=BB0_12 Depth=1
	movl	%eax, %eax
	xorl	%r12d, %r12d
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	jmp	LBB0_21
	.p2align	4, 0x90
LBB0_23:                                ##   in Loop: Header=BB0_21 Depth=2
	incq	%r12
	cmpq	%r12, %rax
	je	LBB0_24
LBB0_21:                                ##   Parent Loop BB0_12 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpq	%r12, %r15
	je	LBB0_23
## %bb.22:                              ##   in Loop: Header=BB0_21 Depth=2
	movq	_ref_rev_parse_rules@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%r15, %r14
	movq	(%rax,%r12,8), %r15
	leaq	-48(%rbp), %r13
	movq	%r13, %rdi
	callq	_strbuf_reset
	movq	%r13, %rdi
	movq	%r15, %rsi
	movq	%r14, %r15
	movl	-68(%rbp), %edx                 ## 4-byte Reload
	movq	%rbx, %rcx
	callq	_strbuf_addf
	movl	-48(%rbp), %esi
	movq	-104(%rbp), %rdi                ## 8-byte Reload
	callq	_refs_ref_exists
	testq	%rax, %rax
	movq	-96(%rbp), %rax                 ## 8-byte Reload
	je	LBB0_23
	jmp	LBB0_17
LBB0_19:
	leaq	-48(%rbp), %rdi
	callq	_strbuf_release
	movq	%rbx, %rdi
	callq	_free
	movq	%r14, %rdi
	callq	_xstrdup
	movq	%rax, %rbx
	jmp	LBB0_25
LBB0_24:
	leaq	-48(%rbp), %rdi
	callq	_strbuf_release
LBB0_25:
	movq	%rbx, %rax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_26:
	movq	%r14, %rdi
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_xstrdup                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_refs_shorten_unambiguous_ref.scanf_fmts,8,3 ## @refs_shorten_unambiguous_ref.scanf_fmts
.zerofill __DATA,__bss,_refs_shorten_unambiguous_ref.nr_rules,4,2 ## @refs_shorten_unambiguous_ref.nr_rules
	.comm	_STRBUF_INIT,4,2                ## @STRBUF_INIT
	.comm	_ref_rev_parse_rules,8,3        ## @ref_rev_parse_rules
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_refs_shorten_unambiguous_ref   ; -- Begin function refs_shorten_unambiguous_ref
	.p2align	2
_refs_shorten_unambiguous_ref:          ; @refs_shorten_unambiguous_ref
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	str	w2, [sp, #12]                   ; 4-byte Folded Spill
	mov	x21, x1
	str	x0, [sp, #16]                   ; 8-byte Folded Spill
Lloh0:
	adrp	x8, _STRBUF_INIT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STRBUF_INIT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [sp, #24]
	adrp	x25, _refs_shorten_unambiguous_ref.nr_rules@PAGE
	ldr	w8, [x25, _refs_shorten_unambiguous_ref.nr_rules@PAGEOFF]
	cbnz	w8, LBB0_10
; %bb.1:
	str	wzr, [x25, _refs_shorten_unambiguous_ref.nr_rules@PAGEOFF]
Lloh3:
	adrp	x26, _ref_rev_parse_rules@GOTPAGE
Lloh4:
	ldr	x26, [x26, _ref_rev_parse_rules@GOTPAGEOFF]
	ldr	x8, [x26]
	ldr	x0, [x8]
	cbz	x0, LBB0_4
; %bb.2:
	mov	x22, #0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	bl	_strlen
	sub	w8, w0, #1
	add	x22, x22, w8, sxtw
	ldrsw	x8, [x25, _refs_shorten_unambiguous_ref.nr_rules@PAGEOFF]
	add	x1, x8, #1
	str	w1, [x25, _refs_shorten_unambiguous_ref.nr_rules@PAGEOFF]
	ldr	x8, [x26]
	ldr	x0, [x8, x1, lsl #3]
	cbnz	x0, LBB0_3
	b	LBB0_5
LBB0_4:
	mov	w1, #0
	mov	x22, #0
LBB0_5:
	mov	w0, #8
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_st_mult
	mov	x1, x22
	bl	_st_add
	bl	_xmalloc
	adrp	x19, _refs_shorten_unambiguous_ref.scanf_fmts@PAGE
	str	x0, [x19, _refs_shorten_unambiguous_ref.scanf_fmts@PAGEOFF]
	ldr	w8, [x25, _refs_shorten_unambiguous_ref.nr_rules@PAGEOFF]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.6:
	mov	x27, x21
	mov	x20, #0
	mov	x21, #0
Lloh5:
	adrp	x23, l_.str@PAGE
Lloh6:
	add	x23, x23, l_.str@PAGEOFF
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	subs	x24, x22, x21
	cset	w0, hi
	bl	_assert
	ldr	x8, [x19, _refs_shorten_unambiguous_ref.scanf_fmts@PAGEOFF]
	ldrsw	x9, [x25, _refs_shorten_unambiguous_ref.nr_rules@PAGEOFF]
	add	x9, x8, x9, lsl #3
	add	x0, x9, x21
	lsl	x9, x20, #3
	str	x0, [x8, x9]
	ldr	x8, [x26]
	ldr	x2, [x8, x9]
	mov	x1, x24
	mov	w3, #2
	mov	x4, x23
	bl	_xsnprintf
	add	x8, x21, x0
	add	x21, x8, #1
	add	x20, x20, #1
	ldrsw	x8, [x25, _refs_shorten_unambiguous_ref.nr_rules@PAGEOFF]
	cmp	x20, x8
	b.lt	LBB0_7
; %bb.8:
	mov	x21, x27
LBB0_9:
	cbz	w8, LBB0_24
LBB0_10:
	mov	x0, x21
	bl	_xstrdup
	mov	x22, x0
	ldr	w26, [x25, _refs_shorten_unambiguous_ref.nr_rules@PAGEOFF]
	cmp	w26, #2
	b.lt	LBB0_21
; %bb.11:
	sub	w8, w26, #1
	b	LBB0_15
LBB0_12:                                ;   in Loop: Header=BB0_15 Depth=1
	mov	w21, #0
LBB0_13:                                ;   in Loop: Header=BB0_15 Depth=1
	cmp	w21, w19
	b.eq	LBB0_22
LBB0_14:                                ;   in Loop: Header=BB0_15 Depth=1
	sub	w8, w27, #1
	cmp	x26, #2
	mov	x26, x20
	mov	x21, x28
	b.le	LBB0_21
LBB0_15:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_19 Depth 2
	mov	w27, w8
	sub	x20, x26, #1
Lloh7:
	adrp	x8, _refs_shorten_unambiguous_ref.scanf_fmts@PAGE
Lloh8:
	ldr	x8, [x8, _refs_shorten_unambiguous_ref.scanf_fmts@PAGEOFF]
	ldr	x1, [x8, w20, uxtw #3]
	mov	x28, x21
	mov	x0, x21
	mov	x2, x22
	bl	_sscanf
	cmp	w0, #1
	b.ne	LBB0_14
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	mov	x0, x22
	bl	_strlen
	ldr	w8, [x25, _refs_shorten_unambiguous_ref.nr_rules@PAGEOFF]
	ldr	w9, [sp, #12]                   ; 4-byte Folded Reload
	cmp	w9, #0
	csel	w19, w20, w8, eq
	cmp	w19, #1
	b.lt	LBB0_12
; %bb.17:                               ;   in Loop: Header=BB0_15 Depth=1
	mov	x23, x0
	mov	x21, #0
	b	LBB0_19
LBB0_18:                                ;   in Loop: Header=BB0_19 Depth=2
	add	x21, x21, #1
	cmp	x19, x21
	b.eq	LBB0_22
LBB0_19:                                ;   Parent Loop BB0_15 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	cmp	x27, x21
	b.eq	LBB0_18
; %bb.20:                               ;   in Loop: Header=BB0_19 Depth=2
Lloh9:
	adrp	x8, _ref_rev_parse_rules@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ref_rev_parse_rules@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	ldr	x24, [x8, x21, lsl #3]
	add	x0, sp, #24
	bl	_strbuf_reset
	add	x0, sp, #24
	mov	x1, x24
	mov	x2, x23
	mov	x3, x22
	bl	_strbuf_addf
	ldr	w1, [sp, #24]
	ldr	x0, [sp, #16]                   ; 8-byte Folded Reload
	bl	_refs_ref_exists
	cbz	x0, LBB0_18
	b	LBB0_13
LBB0_21:
	add	x0, sp, #24
	bl	_strbuf_release
	mov	x0, x22
	bl	_free
	mov	x0, x21
	bl	_xstrdup
	mov	x22, x0
	b	LBB0_23
LBB0_22:
	add	x0, sp, #24
	bl	_strbuf_release
LBB0_23:
	mov	x0, x22
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_24:
	mov	x0, x21
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	b	_xstrdup
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdr	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_refs_shorten_unambiguous_ref.scanf_fmts,8,3 ; @refs_shorten_unambiguous_ref.scanf_fmts
.zerofill __DATA,__bss,_refs_shorten_unambiguous_ref.nr_rules,4,2 ; @refs_shorten_unambiguous_ref.nr_rules
	.comm	_STRBUF_INIT,4,2                ; @STRBUF_INIT
	.comm	_ref_rev_parse_rules,8,3        ; @ref_rev_parse_rules
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s"

.subsections_via_symbols
