	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function write_ref_to_lockfile
_write_ref_to_lockfile:                 ## @write_ref_to_lockfile
	.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	%rdx, %r14
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	_the_repository@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_parse_object
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	(%rax), %rax
	movq	_OBJ_COMMIT@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_5
## %bb.3:
	movl	4(%r15), %edi
	callq	_is_branch
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movq	%rbx, %rdi
	callq	_oid_to_hex
	movl	4(%r15), %ecx
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	_strbuf_addf
	jmp	LBB0_9
LBB0_5:
	movq	%r15, %rdi
	callq	_get_lock_file_fd
	movl	%eax, %r12d
	movq	%rbx, %rdi
	callq	_oid_to_hex
	movq	_the_hash_algo@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rcx), %edx
	movl	%r12d, %edi
	movq	%rax, %rsi
	callq	_write_in_full
	testq	%rax, %rax
	js	LBB0_8
## %bb.6:
	leaq	_write_ref_to_lockfile.term(%rip), %rsi
	movl	%r12d, %edi
	movl	$1, %edx
	callq	_write_in_full
	testq	%rax, %rax
	js	LBB0_8
## %bb.7:
	movq	%r15, %rdi
	callq	_close_ref_gently
	movq	%rax, %rcx
	xorl	%eax, %eax
	testq	%rcx, %rcx
	jns	LBB0_10
LBB0_8:
	movq	%r15, %rdi
	callq	_get_lock_file_path
	movslq	%eax, %rdx
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_strbuf_addf
	jmp	LBB0_9
LBB0_1:
	movslq	4(%r15), %r12
	movq	%rbx, %rdi
	callq	_oid_to_hex
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movq	%r12, %rdx
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	_strbuf_addf
LBB0_9:
	movq	%r15, %rdi
	callq	_unlock_ref
	movl	$-1, %eax
LBB0_10:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__DATA,__data
_write_ref_to_lockfile.term:            ## @write_ref_to_lockfile.term
	.byte	10                              ## 0xa

	.comm	_the_repository,4,2             ## @the_repository
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"trying to write ref '%s' with nonexistent object %s"

	.comm	_OBJ_COMMIT,8,3                 ## @OBJ_COMMIT
L_.str.1:                               ## @.str.1
	.asciz	"trying to write non-commit object %s to branch '%s'"

	.comm	_the_hash_algo,8,3              ## @the_hash_algo
L_.str.2:                               ## @.str.2
	.asciz	"couldn't write '%s'"

	.no_dead_strip	_write_ref_to_lockfile
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function write_ref_to_lockfile
_write_ref_to_lockfile:                 ; @write_ref_to_lockfile
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x20, x2
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _the_repository@GOTPAGE
Lloh1:
	ldr	x8, [x8, _the_repository@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_parse_object
	cbz	x0, LBB0_8
; %bb.1:
	ldr	x8, [x0]
Lloh3:
	adrp	x9, _OBJ_COMMIT@GOTPAGE
Lloh4:
	ldr	x9, [x9, _OBJ_COMMIT@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_4
; %bb.2:
	ldr	w0, [x19, #4]
	bl	_is_branch
	cbz	x0, LBB0_4
; %bb.3:
	mov	x0, x21
	bl	_oid_to_hex
	mov	x2, x0
	ldr	w8, [x19, #4]
	str	x8, [sp]
Lloh6:
	adrp	x1, l_.str.1@PAGE
Lloh7:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_10
LBB0_4:
	mov	x0, x19
	bl	_get_lock_file_fd
	mov	x22, x0
	mov	x0, x21
	bl	_oid_to_hex
	mov	x1, x0
Lloh8:
	adrp	x8, _the_hash_algo@GOTPAGE
Lloh9:
	ldr	x8, [x8, _the_hash_algo@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	ldr	w2, [x8]
	mov	x0, x22
	bl	_write_in_full
	tbnz	x0, #63, LBB0_9
; %bb.5:
Lloh11:
	adrp	x1, _write_ref_to_lockfile.term@PAGE
Lloh12:
	add	x1, x1, _write_ref_to_lockfile.term@PAGEOFF
	mov	x0, x22
	mov	w2, #1
	bl	_write_in_full
	tbnz	x0, #63, LBB0_9
; %bb.6:
	mov	x0, x19
	bl	_close_ref_gently
	tbnz	x0, #63, LBB0_9
; %bb.7:
	mov	w0, #0
	b	LBB0_12
LBB0_8:
	ldrsw	x22, [x19, #4]
	mov	x0, x21
	bl	_oid_to_hex
	str	x0, [sp]
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	mov	x2, x22
	b	LBB0_11
LBB0_9:
	mov	x0, x19
	bl	_get_lock_file_path
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x2, w0
Lloh15:
	adrp	x1, l_.str.2@PAGE
Lloh16:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_10:
	mov	x0, x20
LBB0_11:
	bl	_strbuf_addf
	mov	x0, x19
	bl	_unlock_ref
	mov	w0, #-1
LBB0_12:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.section	__DATA,__data
_write_ref_to_lockfile.term:            ; @write_ref_to_lockfile.term
	.byte	10                              ; 0xa

	.comm	_the_repository,4,2             ; @the_repository
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"trying to write ref '%s' with nonexistent object %s"

	.comm	_OBJ_COMMIT,8,3                 ; @OBJ_COMMIT
l_.str.1:                               ; @.str.1
	.asciz	"trying to write non-commit object %s to branch '%s'"

	.comm	_the_hash_algo,8,3              ; @the_hash_algo
l_.str.2:                               ; @.str.2
	.asciz	"couldn't write '%s'"

	.no_dead_strip	_write_ref_to_lockfile
.subsections_via_symbols
