	.file	"671024.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"open(%s) failed"
.LC1:
	.string	"write failed"
.LC2:
	.string	"stat(%s) failed"
.LC3:
	.string	"link(%s, %s) failed"
	.align 8
.LC4:
	.string	"files st_dev is different, want: %lu, got: %lu"
	.align 8
.LC5:
	.string	"files st_ino is different, want: %lu, got: %lu"
	.align 8
.LC6:
	.string	"wrong nlink, want: %lu, got: %lu"
.LC7:
	.string	"read failed"
.LC8:
	.string	"file content mismatch: %s"
.LC9:
	.string	"unlink(%s) failed"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 400
	mov	DWORD PTR -388[rbp], edi
	mov	QWORD PTR -400[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	movabs	rax, 32783537688308847
	mov	QWORD PTR -80[rbp], rax
	lea	rax, -80[rbp]
	mov	edx, 384
	mov	esi, 578
	mov	rdi, rax
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -372[rbp], eax
	cmp	DWORD PTR -372[rbp], 0
	jns	.L2
	lea	rax, -80[rbp]
	mov	rdx, rax
	lea	rsi, .LC0[rip]
	mov	edi, 1
	mov	eax, 0
	call	errx@PLT
.L2:
	movabs	rax, 7953763900379197299
	movabs	rdx, 8389765627374301028
	mov	QWORD PTR -64[rbp], rax
	mov	QWORD PTR -56[rbp], rdx
	mov	DWORD PTR -48[rbp], 7630437
	lea	rcx, -64[rbp]
	mov	eax, DWORD PTR -372[rbp]
	mov	edx, 20
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	test	rax, rax
	jns	.L3
	lea	rsi, .LC1[rip]
	mov	edi, 1
	mov	eax, 0
	call	err@PLT
.L3:
	mov	eax, DWORD PTR -372[rbp]
	mov	edi, eax
	call	close@PLT
	lea	rdx, -368[rbp]
	lea	rax, -80[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	stat@PLT
	test	eax, eax
	je	.L4
	lea	rax, -80[rbp]
	mov	rdx, rax
	lea	rsi, .LC2[rip]
	mov	edi, 1
	mov	eax, 0
	call	errx@PLT
.L4:
	movabs	rax, 32783537689552238
	mov	QWORD PTR -72[rbp], rax
	lea	rdx, -72[rbp]
	lea	rax, -80[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	link@PLT
	test	eax, eax
	je	.L5
	lea	rdx, -72[rbp]
	lea	rax, -80[rbp]
	mov	rcx, rdx
	mov	rdx, rax
	lea	rsi, .LC3[rip]
	mov	edi, 1
	mov	eax, 0
	call	errx@PLT
.L5:
	lea	rdx, -224[rbp]
	lea	rax, -72[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	stat@PLT
	test	eax, eax
	je	.L6
	lea	rax, -72[rbp]
	mov	rdx, rax
	lea	rsi, .LC2[rip]
	mov	edi, 1
	mov	eax, 0
	call	errx@PLT
.L6:
	mov	rdx, QWORD PTR -368[rbp]
	mov	rax, QWORD PTR -224[rbp]
	cmp	rdx, rax
	je	.L7
	mov	rdx, QWORD PTR -224[rbp]
	mov	rax, QWORD PTR -368[rbp]
	mov	rcx, rdx
	mov	rdx, rax
	lea	rsi, .LC4[rip]
	mov	edi, 1
	mov	eax, 0
	call	errx@PLT
.L7:
	mov	rdx, QWORD PTR -360[rbp]
	mov	rax, QWORD PTR -216[rbp]
	cmp	rdx, rax
	je	.L8
	mov	rdx, QWORD PTR -216[rbp]
	mov	rax, QWORD PTR -360[rbp]
	mov	rcx, rdx
	mov	rdx, rax
	lea	rsi, .LC5[rip]
	mov	edi, 1
	mov	eax, 0
	call	errx@PLT
.L8:
	mov	rax, QWORD PTR -208[rbp]
	mov	rdx, QWORD PTR -352[rbp]
	add	rdx, 1
	cmp	rax, rdx
	je	.L9
	mov	rax, QWORD PTR -208[rbp]
	mov	rdx, QWORD PTR -352[rbp]
	add	rdx, 1
	mov	rcx, rax
	lea	rsi, .LC6[rip]
	mov	edi, 1
	mov	eax, 0
	call	errx@PLT
.L9:
	lea	rax, -72[rbp]
	mov	esi, 0
	mov	rdi, rax
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -372[rbp], eax
	cmp	DWORD PTR -372[rbp], 0
	jns	.L10
	lea	rax, -72[rbp]
	mov	rdx, rax
	lea	rsi, .LC0[rip]
	mov	edi, 1
	mov	eax, 0
	call	errx@PLT
.L10:
	mov	QWORD PTR -32[rbp], 0
	mov	QWORD PTR -24[rbp], 0
	mov	DWORD PTR -16[rbp], 0
	lea	rcx, -32[rbp]
	mov	eax, DWORD PTR -372[rbp]
	mov	edx, 20
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	test	rax, rax
	jns	.L11
	lea	rsi, .LC7[rip]
	mov	edi, 1
	mov	eax, 0
	call	err@PLT
.L11:
	mov	eax, DWORD PTR -372[rbp]
	mov	edi, eax
	call	close@PLT
	lea	rdx, -64[rbp]
	lea	rax, -32[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	je	.L12
	lea	rax, -32[rbp]
	mov	rdx, rax
	lea	rsi, .LC8[rip]
	mov	edi, 1
	mov	eax, 0
	call	errx@PLT
.L12:
	lea	rax, -72[rbp]
	mov	rdi, rax
	call	unlink@PLT
	test	eax, eax
	je	.L13
	lea	rax, -72[rbp]
	mov	rdx, rax
	lea	rsi, .LC9[rip]
	mov	edi, 1
	mov	eax, 0
	call	errx@PLT
.L13:
	lea	rax, -80[rbp]
	mov	rdi, rax
	call	unlink@PLT
	test	eax, eax
	je	.L14
	lea	rax, -80[rbp]
	mov	rdx, rax
	lea	rsi, .LC9[rip]
	mov	edi, 1
	mov	eax, 0
	call	errx@PLT
.L14:
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"671024.c"
	.text
	.section	.rodata
	.align	2
.LC1:
	.ascii	"open(%s) failed\000"
	.align	2
.LC3:
	.ascii	"write failed\000"
	.align	2
.LC4:
	.ascii	"stat(%s) failed\000"
	.align	2
.LC6:
	.ascii	"link(%s, %s) failed\000"
	.align	2
.LC7:
	.ascii	"files st_dev is different, want: %lu, got: %lu\000"
	.align	2
.LC8:
	.ascii	"files st_ino is different, want: %lu, got: %lu\000"
	.align	2
.LC9:
	.ascii	"wrong nlink, want: %lu, got: %lu\000"
	.align	2
.LC10:
	.ascii	"read failed\000"
	.align	2
.LC11:
	.ascii	"file content mismatch: %s\000"
	.align	2
.LC12:
	.ascii	"unlink(%s) failed\000"
	.align	2
.LC0:
	.ascii	"old.txt\000"
	.align	2
.LC2:
	.ascii	"some random content\000"
	.align	2
.LC5:
	.ascii	"new.txt\000"
	.align	2
.LC13:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 256
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #264
	str	r0, [fp, #-256]
	str	r1, [fp, #-260]
	ldr	r3, .L17
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r2, .L17+4
	sub	r3, fp, #64
	ldm	r2, {r0, r1}
	stm	r3, {r0, r1}
	sub	r3, fp, #64
	mov	r2, #384
	ldr	r1, .L17+8
	mov	r0, r3
	bl	open
	str	r0, [fp, #-248]
	ldr	r3, [fp, #-248]
	cmp	r3, #0
	bge	.L2
	sub	r3, fp, #64
	mov	r2, r3
	ldr	r1, .L17+12
	mov	r0, #1
	bl	errx
.L2:
	ldr	r3, .L17+16
	sub	ip, fp, #48
	mov	lr, r3
	ldmia	lr!, {r0, r1, r2, r3}
	stmia	ip!, {r0, r1, r2, r3}
	ldr	r3, [lr]
	str	r3, [ip]
	sub	r3, fp, #48
	mov	r2, #20
	mov	r1, r3
	ldr	r0, [fp, #-248]
	bl	write
	mov	r3, r0
	cmp	r3, #0
	bge	.L3
	ldr	r1, .L17+20
	mov	r0, #1
	bl	err
.L3:
	ldr	r0, [fp, #-248]
	bl	close
	sub	r2, fp, #244
	sub	r3, fp, #64
	mov	r1, r2
	mov	r0, r3
	bl	stat
	mov	r3, r0
	cmp	r3, #0
	beq	.L4
	sub	r3, fp, #64
	mov	r2, r3
	ldr	r1, .L17+24
	mov	r0, #1
	bl	errx
.L4:
	ldr	r2, .L17+28
	sub	r3, fp, #56
	ldm	r2, {r0, r1}
	stm	r3, {r0, r1}
	sub	r2, fp, #56
	sub	r3, fp, #64
	mov	r1, r2
	mov	r0, r3
	bl	link
	mov	r3, r0
	cmp	r3, #0
	beq	.L5
	sub	r3, fp, #56
	sub	r2, fp, #64
	ldr	r1, .L17+32
	mov	r0, #1
	bl	errx
.L5:
	sub	r2, fp, #156
	sub	r3, fp, #56
	mov	r1, r2
	mov	r0, r3
	bl	stat
	mov	r3, r0
	cmp	r3, #0
	beq	.L6
	sub	r3, fp, #56
	mov	r2, r3
	ldr	r1, .L17+24
	mov	r0, #1
	bl	errx
.L6:
	sub	r1, fp, #244
	ldmia	r1, {r0-r1}
	sub	r3, fp, #156
	ldmia	r3, {r2-r3}
	cmp	r1, r3
	cmpeq	r0, r2
	beq	.L7
	sub	r1, fp, #244
	ldmia	r1, {r0-r1}
	sub	r3, fp, #156
	ldmia	r3, {r2-r3}
	stm	sp, {r2-r3}
	mov	r2, r0
	mov	r3, r1
	ldr	r1, .L17+36
	mov	r0, #1
	bl	errx
.L7:
	ldr	r2, [fp, #-232]
	ldr	r3, [fp, #-144]
	cmp	r2, r3
	beq	.L8
	ldr	r2, [fp, #-232]
	ldr	r3, [fp, #-144]
	ldr	r1, .L17+40
	mov	r0, #1
	bl	errx
.L8:
	ldr	r2, [fp, #-136]
	ldr	r3, [fp, #-224]
	add	r3, r3, #1
	cmp	r2, r3
	beq	.L9
	ldr	r3, [fp, #-224]
	add	r2, r3, #1
	ldr	r3, [fp, #-136]
	ldr	r1, .L17+44
	mov	r0, #1
	bl	errx
.L9:
	sub	r3, fp, #56
	mov	r1, #0
	mov	r0, r3
	bl	open
	str	r0, [fp, #-248]
	ldr	r3, [fp, #-248]
	cmp	r3, #0
	bge	.L10
	sub	r3, fp, #56
	mov	r2, r3
	ldr	r1, .L17+12
	mov	r0, #1
	bl	errx
.L10:
	mov	r3, #0
	str	r3, [fp, #-28]
	sub	r3, fp, #24
	mov	r2, #0
	str	r2, [r3]
	str	r2, [r3, #4]
	str	r2, [r3, #8]
	str	r2, [r3, #12]
	sub	r3, fp, #28
	mov	r2, #20
	mov	r1, r3
	ldr	r0, [fp, #-248]
	bl	read
	mov	r3, r0
	cmp	r3, #0
	bge	.L11
	ldr	r1, .L17+48
	mov	r0, #1
	bl	err
.L11:
	ldr	r0, [fp, #-248]
	bl	close
	sub	r2, fp, #48
	sub	r3, fp, #28
	mov	r1, r2
	mov	r0, r3
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	beq	.L12
	sub	r3, fp, #28
	mov	r2, r3
	ldr	r1, .L17+52
	mov	r0, #1
	bl	errx
.L12:
	sub	r3, fp, #56
	mov	r0, r3
	bl	unlink
	mov	r3, r0
	cmp	r3, #0
	beq	.L13
	sub	r3, fp, #56
	mov	r2, r3
	ldr	r1, .L17+56
	mov	r0, #1
	bl	errx
.L13:
	sub	r3, fp, #64
	mov	r0, r3
	bl	unlink
	mov	r3, r0
	cmp	r3, #0
	beq	.L14
	sub	r3, fp, #64
	mov	r2, r3
	ldr	r1, .L17+56
	mov	r0, #1
	bl	errx
.L14:
	mov	r3, #0
	ldr	r2, .L17
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L16
	bl	__stack_chk_fail
.L16:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L18:
	.align	2
.L17:
	.word	.LC13
	.word	.LC0
	.word	578
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
