	.file	"646782.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"write fail %s\n"
.LC1:
	.string	"pid %d succ write %d byte\n"
	.text
	.globl	race_write
	.type	race_write, @function
race_write:
.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, 4096
	or	QWORD PTR [rsp], 0
	sub	rsp, 48
	mov	DWORD PTR -4132[rbp], edi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	QWORD PTR -4112[rbp], 0
	mov	QWORD PTR -4104[rbp], 0
	lea	rdx, -4096[rbp]
	mov	eax, 0
	mov	ecx, 510
	mov	rdi, rdx
	rep stosq
	call	fork@PLT
	mov	DWORD PTR -4120[rbp], eax
	cmp	DWORD PTR -4120[rbp], 0
	js	.L2
	cmp	DWORD PTR -4120[rbp], 0
	jne	.L3
.L6:
	mov	eax, DWORD PTR -4132[rbp]
	mov	edx, 0
	mov	esi, 0
	mov	edi, eax
	call	lseek@PLT
	lea	rcx, -4112[rbp]
	mov	eax, DWORD PTR -4132[rbp]
	mov	edx, 8
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	mov	DWORD PTR -4116[rbp], eax
	cmp	DWORD PTR -4116[rbp], 0
	jns	.L4
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L6
.L4:
	call	getpid@PLT
	mov	ecx, eax
	mov	eax, DWORD PTR -4116[rbp]
	mov	edx, eax
	mov	esi, ecx
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L6
.L3:
	call	fork@PLT
	mov	DWORD PTR -4120[rbp], eax
	cmp	DWORD PTR -4120[rbp], 0
	js	.L2
	cmp	DWORD PTR -4120[rbp], 0
	jne	.L7
.L10:
	call	rand@PLT
	cdq
	shr	edx, 20
	add	eax, edx
	and	eax, 4095
	sub	eax, edx
	movsx	rdx, eax
	lea	rcx, -4112[rbp]
	mov	eax, DWORD PTR -4132[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	mov	DWORD PTR -4116[rbp], eax
	cmp	DWORD PTR -4116[rbp], 0
	jns	.L8
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L10
.L8:
	call	getpid@PLT
	mov	ecx, eax
	mov	eax, DWORD PTR -4116[rbp]
	mov	edx, eax
	mov	esi, ecx
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L10
.L7:
	mov	eax, DWORD PTR -4132[rbp]
	mov	edx, 0
	mov	esi, 0
	mov	edi, eax
	call	lseek@PLT
	call	rand@PLT
	cdq
	shr	edx, 20
	add	eax, edx
	and	eax, 4095
	sub	eax, edx
	movsx	rdx, eax
	lea	rcx, -4112[rbp]
	mov	eax, DWORD PTR -4132[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	mov	DWORD PTR -4116[rbp], eax
	cmp	DWORD PTR -4116[rbp], 0
	jns	.L11
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L7
.L11:
	call	getpid@PLT
	mov	ecx, eax
	mov	eax, DWORD PTR -4116[rbp]
	mov	edx, eax
	mov	esi, ecx
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L7
.L2:
	mov	eax, 0
	mov	rsi, QWORD PTR -8[rbp]
	sub	rsi, QWORD PTR fs:40
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	race_write, .-race_write
	.section	.rodata
	.align 8
.LC2:
	.string	"/sys/devices/soc/7577000.i2c/i2c-3/3-0020/input/input3/rmidev/data"
.LC3:
	.string	"open %s fail %s\n"
.LC4:
	.string	"open %s succ\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 32
	mov	DWORD PTR -20[rbp], edi
	mov	QWORD PTR -32[rbp], rsi
	lea	rax, .LC2[rip]
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -8[rbp]
	mov	esi, 2
	mov	rdi, rax
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -12[rbp], eax
	cmp	DWORD PTR -12[rbp], 0
	jns	.L16
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rdx, rax
	mov	rax, QWORD PTR -8[rbp]
	mov	rsi, rax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L17
.L16:
	mov	rax, QWORD PTR -8[rbp]
	mov	rsi, rax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -12[rbp]
	mov	edi, eax
	call	race_write
	mov	eax, DWORD PTR -12[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, 0
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	"646782.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"write fail %s\012\000"
	.align	2
.LC1:
	.ascii	"pid %d succ write %d byte\012\000"
	.align	2
.LC2:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	race_write
	.syntax unified
	.arm
	.fpu softvfp
	.type	race_write, %function
race_write:
	@ args = 0, pretend = 0, frame = 4120
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #4096
	sub	sp, sp, #28
	sub	r3, fp, #4096
	sub	r3, r3, #12
	str	r0, [r3, #-20]
	ldr	r3, .L15
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #0
	str	r3, [r2, #-4]
	mov	r0, r2
	ldr	r3, .L15+4
	mov	r2, r3
	mov	r1, #0
	bl	memset
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	bl	fork
	mov	r3, r0
	str	r3, [r4, #-12]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-12]
	cmp	r3, #0
	blt	.L2
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-12]
	cmp	r3, #0
	bne	.L3
.L6:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [r3, #-20]
	bl	lseek
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	sub	r2, fp, #4096
	sub	r2, r2, #12
	mov	r0, r2
	mov	r2, #8
	mov	r1, r3
	ldr	r0, [r0, #-20]
	bl	write
	str	r0, [r4, #-8]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-8]
	cmp	r3, #0
	bge	.L4
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L15+8
	bl	printf
	b	.L6
.L4:
	bl	getpid
	mov	r3, r0
	sub	r2, fp, #4096
	sub	r2, r2, #12
	ldr	r2, [r2, #-8]
	mov	r1, r3
	ldr	r0, .L15+12
	bl	printf
	b	.L6
.L3:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	bl	fork
	mov	r3, r0
	str	r3, [r4, #-12]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-12]
	cmp	r3, #0
	blt	.L2
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-12]
	cmp	r3, #0
	bne	.L7
.L10:
	bl	rand
	mov	r3, r0
	rsbs	r2, r3, #0
	lsl	r3, r3, #20
	lsr	r3, r3, #20
	lsl	r2, r2, #20
	lsr	r2, r2, #20
	rsbpl	r3, r2, #0
	mov	r1, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	sub	r2, fp, #4096
	sub	r2, r2, #12
	mov	r0, r2
	mov	r2, r1
	mov	r1, r3
	ldr	r0, [r0, #-20]
	bl	write
	str	r0, [r4, #-8]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-8]
	cmp	r3, #0
	bge	.L8
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L15+8
	bl	printf
	b	.L10
.L8:
	bl	getpid
	mov	r3, r0
	sub	r2, fp, #4096
	sub	r2, r2, #12
	ldr	r2, [r2, #-8]
	mov	r1, r3
	ldr	r0, .L15+12
	bl	printf
	b	.L10
.L7:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [r3, #-20]
	bl	lseek
	bl	rand
	mov	r3, r0
	rsbs	r2, r3, #0
	lsl	r3, r3, #20
	lsr	r3, r3, #20
	lsl	r2, r2, #20
	lsr	r2, r2, #20
	rsbpl	r3, r2, #0
	mov	r1, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	sub	r2, fp, #4096
	sub	r2, r2, #12
	mov	r0, r2
	mov	r2, r1
	mov	r1, r3
	ldr	r0, [r0, #-20]
	bl	write
	str	r0, [r4, #-8]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-8]
	cmp	r3, #0
	bge	.L11
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L15+8
	bl	printf
	b	.L7
.L11:
	bl	getpid
	mov	r3, r0
	sub	r2, fp, #4096
	sub	r2, r2, #12
	ldr	r2, [r2, #-8]
	mov	r1, r3
	ldr	r0, .L15+12
	bl	printf
	b	.L7
.L2:
	mov	r3, #0
	ldr	r2, .L15
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L14
	bl	__stack_chk_fail
.L14:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L16:
	.align	2
.L15:
	.word	.LC2
	.word	4092
	.word	.LC0
	.word	.LC1
	.size	race_write, .-race_write
	.section	.rodata
	.align	2
.LC3:
	.ascii	"/sys/devices/soc/7577000.i2c/i2c-3/3-0020/input/inp"
	.ascii	"ut3/rmidev/data\000"
	.align	2
.LC4:
	.ascii	"open %s fail %s\012\000"
	.align	2
.LC5:
	.ascii	"open %s succ\012\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	ldr	r3, .L20
	str	r3, [fp, #-12]
	mov	r1, #2
	ldr	r0, [fp, #-12]
	bl	open
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bge	.L18
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	mov	r2, r3
	ldr	r1, [fp, #-12]
	ldr	r0, .L20+4
	bl	printf
	mvn	r3, #0
	b	.L19
.L18:
	ldr	r1, [fp, #-12]
	ldr	r0, .L20+8
	bl	printf
	ldr	r0, [fp, #-8]
	bl	race_write
	ldr	r0, [fp, #-8]
	bl	close
	mov	r3, #0
.L19:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L21:
	.align	2
.L20:
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
