	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rename_file
_rename_file:                           ## @rename_file
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r8d, %r15d
	movq	%rcx, %rbx
	movq	%rdx, %r12
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	_fclose
	testq	%rbx, %rbx
	setne	%al
	testq	%r12, %r12
	setne	%cl
	andb	%al, %cl
	movzbl	%cl, %edi
	callq	_vcos_assert
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_rename
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_strerror
	leaq	L_.str(%rip), %rdi
	movq	%r12, %rsi
	movl	%eax, %edx
	callq	_vcos_log_error
LBB0_2:
	movq	(%r14), %rdx
	testq	%rdx, %rdx
	je	LBB0_12
## %bb.3:
	leaq	-48(%rbp), %rdi
	leaq	-40(%rbp), %rsi
	movl	%r15d, %ecx
	callq	_create_filenames
	movq	_MMAL_SUCCESS@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_7
## %bb.4:
	movq	-40(%rbp), %rsi
	movq	%r12, %rdi
	callq	_link
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movq	-40(%rbp), %rsi
	movq	%r12, %rdi
	callq	_symlink
	testq	%rax, %rax
	jne	LBB0_7
LBB0_6:
	movq	-40(%rbp), %rdi
	movq	-48(%rbp), %rsi
	callq	_rename
	testq	%rax, %rax
	je	LBB0_8
LBB0_7:
	movq	(%r14), %rbx
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_strerror
	leaq	L_.str.1(%rip), %rdi
	movq	%rbx, %rsi
	movl	%eax, %edx
	callq	_vcos_log_error
LBB0_8:
	movq	-40(%rbp), %rdi
	testq	%rdi, %rdi
	je	LBB0_10
## %bb.9:
	callq	_free
LBB0_10:
	movq	-48(%rbp), %rdi
	testq	%rdi, %rdi
	je	LBB0_12
## %bb.11:
	callq	_free
LBB0_12:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not rename temp file to: %s; %s"

	.comm	_errno,4,2                      ## @errno
	.comm	_MMAL_SUCCESS,4,2               ## @MMAL_SUCCESS
L_.str.1:                               ## @.str.1
	.asciz	"Could not link as filename: %s; %s"

	.no_dead_strip	_rename_file
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rename_file
_rename_file:                           ; @rename_file
	.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	x21, x4
	mov	x22, x3
	mov	x20, x2
	mov	x19, x0
	mov	x0, x1
	bl	_fclose
	cmp	x20, #0
	ccmp	x22, #0, #4, ne
	cset	w0, ne
	bl	_vcos_assert
	mov	x0, x22
	mov	x1, x20
	bl	_rename
Lloh0:
	adrp	x22, _errno@GOTPAGE
Lloh1:
	ldr	x22, [x22, _errno@GOTPAGEOFF]
	cbz	x0, LBB0_2
; %bb.1:
	ldr	w0, [x22]
	bl	_strerror
	mov	x2, x0
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_vcos_log_error
LBB0_2:
	ldr	x2, [x19]
	cbz	x2, LBB0_12
; %bb.3:
	mov	x0, sp
	add	x1, sp, #8
	mov	x3, x21
	bl	_create_filenames
Lloh4:
	adrp	x8, _MMAL_SUCCESS@GOTPAGE
Lloh5:
	ldr	x8, [x8, _MMAL_SUCCESS@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_7
; %bb.4:
	ldr	x1, [sp, #8]
	mov	x0, x20
	bl	_link
	cbz	x0, LBB0_6
; %bb.5:
	ldr	x1, [sp, #8]
	mov	x0, x20
	bl	_symlink
	cbnz	x0, LBB0_7
LBB0_6:
	ldp	x1, x0, [sp]
	bl	_rename
	cbz	x0, LBB0_8
LBB0_7:
	ldr	x19, [x19]
	ldr	w0, [x22]
	bl	_strerror
	mov	x2, x0
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x19
	bl	_vcos_log_error
LBB0_8:
	ldr	x0, [sp, #8]
	cbz	x0, LBB0_10
; %bb.9:
	bl	_free
LBB0_10:
	ldr	x0, [sp]
	cbz	x0, LBB0_12
; %bb.11:
	bl	_free
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 AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not rename temp file to: %s; %s"

	.comm	_errno,4,2                      ; @errno
	.comm	_MMAL_SUCCESS,4,2               ; @MMAL_SUCCESS
l_.str.1:                               ; @.str.1
	.asciz	"Could not link as filename: %s; %s"

	.no_dead_strip	_rename_file
.subsections_via_symbols
