	.file	"712741.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"w"
	.align 8
.LC1:
	.string	"/sys/devices/platform/power_ctrl/poweroff-gpio/edge"
.LC2:
	.string	"set_edge"
.LC3:
	.string	"both\n"
	.text
	.globl	set_edge
	.type	set_edge, @function
set_edge:
.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, 16
	lea	rsi, .LC0[rip]
	lea	rdi, .LC1[rip]
	call	fopen@PLT
	mov	QWORD PTR -8[rbp], rax
	cmp	QWORD PTR -8[rbp], 0
	jne	.L2
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L2:
	mov	rax, QWORD PTR -8[rbp]
	mov	rcx, rax
	mov	edx, 5
	mov	esi, 1
	lea	rdi, .LC3[rip]
	call	fwrite@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	fclose@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	set_edge, .-set_edge
	.section	.rodata
	.align 8
.LC4:
	.string	"/sys/devices/platform/power_ctrl/poweroff-gpio/value"
.LC5:
	.string	"poll"
.LC6:
	.string	"shutdown -P now"
	.text
	.globl	poll_pin
	.type	poll_pin, @function
poll_pin:
.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, 80
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	BYTE PTR -9[rbp], 0
	mov	BYTE PTR -73[rbp], 0
	mov	esi, 0
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -72[rbp], eax
	lea	rcx, -11[rbp]
	mov	eax, DWORD PTR -72[rbp]
	mov	edx, 2
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	mov	eax, DWORD PTR -72[rbp]
	mov	DWORD PTR -20[rbp], eax
	mov	WORD PTR -16[rbp], 2
.L7:
	lea	rax, -20[rbp]
	mov	edx, -1
	mov	esi, 1
	mov	rdi, rax
	call	poll@PLT
	mov	DWORD PTR -68[rbp], eax
	cmp	DWORD PTR -68[rbp], -1
	jne	.L4
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L4:
	movzx	eax, WORD PTR -14[rbp]
	cwde
	and	eax, 2
	test	eax, eax
	je	.L7
	mov	eax, DWORD PTR -20[rbp]
	mov	edx, 0
	mov	esi, 0
	mov	edi, eax
	call	lseek@PLT
	mov	eax, DWORD PTR -20[rbp]
	lea	rcx, -11[rbp]
	mov	edx, 2
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	lea	rax, -48[rbp]
	mov	rsi, rax
	mov	edi, 1
	call	clock_gettime@PLT
	mov	rax, QWORD PTR -48[rbp]
	imul	rdx, rax, 1000000000
	mov	rax, QWORD PTR -40[rbp]
	add	rax, rdx
	mov	QWORD PTR -56[rbp], rax
	cmp	BYTE PTR -73[rbp], 0
	jne	.L6
	movzx	eax, BYTE PTR -11[rbp]
	cmp	al, 49
	jne	.L6
	mov	rax, QWORD PTR -56[rbp]
	mov	QWORD PTR -64[rbp], rax
	mov	BYTE PTR -73[rbp], 1
	jmp	.L5
.L6:
	cmp	BYTE PTR -73[rbp], 1
	jne	.L7
	movzx	eax, BYTE PTR -11[rbp]
	cmp	al, 48
	jne	.L7
	mov	rax, QWORD PTR -56[rbp]
	sub	rax, QWORD PTR -64[rbp]
	cmp	rax, 100000
	jle	.L7
	mov	BYTE PTR -73[rbp], 0
	lea	rdi, .LC6[rip]
	call	system@PLT
.L5:
	jmp	.L7
	.cfi_endproc
.LFE7:
	.size	poll_pin, .-poll_pin
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	eax, 0
	call	set_edge
	mov	eax, 0
	call	poll_pin
	mov	eax, 0
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	"712741.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"w\000"
	.align	2
.LC1:
	.ascii	"/sys/devices/platform/power_ctrl/poweroff-gpio/edge"
	.ascii	"\000"
	.align	2
.LC2:
	.ascii	"set_edge\000"
	.align	2
.LC3:
	.ascii	"both\012\000"
	.text
	.align	2
	.global	set_edge
	.syntax unified
	.arm
	.fpu softvfp
	.type	set_edge, %function
set_edge:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r1, .L3
	ldr	r0, .L3+4
	bl	fopen
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L2
	ldr	r0, .L3+8
	bl	perror
	mov	r0, #1
	bl	exit
.L2:
	ldr	r3, [fp, #-8]
	mov	r2, #5
	mov	r1, #1
	ldr	r0, .L3+12
	bl	fwrite
	ldr	r0, [fp, #-8]
	bl	fclose
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L4:
	.align	2
.L3:
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.size	set_edge, .-set_edge
	.section	.rodata
	.align	2
.LC4:
	.ascii	"/sys/devices/platform/power_ctrl/poweroff-gpio/valu"
	.ascii	"e\000"
	.align	2
.LC5:
	.ascii	"poll\000"
	.align	2
.LC6:
	.ascii	"shutdown -P now\000"
	.align	2
.LC7:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	poll_pin
	.syntax unified
	.arm
	.fpu softvfp
	.type	poll_pin, %function
poll_pin:
	@ args = 0, pretend = 0, frame = 56
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, fp, lr}
	add	fp, sp, #20
	sub	sp, sp, #56
	ldr	r3, .L11
	ldr	r3, [r3]
	str	r3, [fp, #-24]
	mov	r3,#0
	mov	r3, #0
	strb	r3, [fp, #-26]
	mov	r3, #0
	strb	r3, [fp, #-69]
	mov	r1, #0
	ldr	r0, .L11+4
	bl	open
	str	r0, [fp, #-68]
	sub	r3, fp, #28
	mov	r2, #2
	mov	r1, r3
	ldr	r0, [fp, #-68]
	bl	read
	ldr	r3, [fp, #-68]
	str	r3, [fp, #-36]
	mov	r3, #2
	strh	r3, [fp, #-32]	@ movhi
.L9:
	sub	r3, fp, #36
	mvn	r2, #0
	mov	r1, #1
	mov	r0, r3
	bl	poll
	str	r0, [fp, #-64]
	ldr	r3, [fp, #-64]
	cmn	r3, #1
	bne	.L6
	ldr	r0, .L11+8
	bl	perror
	mov	r0, #1
	bl	exit
.L6:
	ldrsh	r3, [fp, #-30]
	lsl	r3, r3, #16
	lsr	r3, r3, #16
	and	r3, r3, #2
	cmp	r3, #0
	beq	.L9
	ldr	r3, [fp, #-36]
	mov	r2, #0
	mov	r1, #0
	mov	r0, r3
	bl	lseek
	ldr	r3, [fp, #-36]
	sub	r1, fp, #28
	mov	r2, #2
	mov	r0, r3
	bl	read
	sub	r3, fp, #44
	mov	r1, r3
	mov	r0, #1
	bl	clock_gettime
	ldr	r3, [fp, #-44]
	mov	r0, r3
	asr	r1, r0, #31
	ldr	r3, .L11+12
	mul	r2, r3, r1
	mov	r3, #0
	mul	r3, r0, r3
	add	ip, r2, r3
	ldr	lr, .L11+12
	umull	r2, r3, r0, lr
	add	r1, ip, r3
	mov	r3, r1
	ldr	r1, [fp, #-40]
	mov	r0, r1
	asr	r1, r0, #31
	adds	r6, r2, r0
	adc	r7, r3, r1
	str	r6, [fp, #-52]
	str	r7, [fp, #-48]
	ldrb	r3, [fp, #-69]	@ zero_extendqisi2
	cmp	r3, #0
	bne	.L8
	ldrb	r3, [fp, #-28]	@ zero_extendqisi2
	cmp	r3, #49
	bne	.L8
	sub	r3, fp, #52
	ldmia	r3, {r2-r3}
	str	r2, [fp, #-60]
	str	r3, [fp, #-56]
	mov	r3, #1
	strb	r3, [fp, #-69]
	b	.L7
.L8:
	ldrb	r3, [fp, #-69]	@ zero_extendqisi2
	cmp	r3, #1
	bne	.L9
	ldrb	r3, [fp, #-28]	@ zero_extendqisi2
	cmp	r3, #48
	bne	.L9
	sub	r1, fp, #52
	ldmia	r1, {r0-r1}
	sub	r3, fp, #60
	ldmia	r3, {r2-r3}
	subs	r4, r0, r2
	sbc	r5, r1, r3
	ldr	r2, .L11+16
	mov	r3, #0
	cmp	r2, r4
	sbcs	r3, r3, r5
	bge	.L9
	mov	r3, #0
	strb	r3, [fp, #-69]
	ldr	r0, .L11+20
	bl	system
.L7:
	b	.L9
.L12:
	.align	2
.L11:
	.word	.LC7
	.word	.LC4
	.word	.LC5
	.word	1000000000
	.word	100000
	.word	.LC6
	.size	poll_pin, .-poll_pin
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	bl	set_edge
	bl	poll_pin
	mov	r3, #0
	mov	r0, r3
	pop	{fp, pc}
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
