	.file	"591540.c"
	.intel_syntax noprefix
	.text
	.globl	attemptbadwritestr
	.section	.rodata
	.align 16
	.type	attemptbadwritestr, @object
	.size	attemptbadwritestr, 16
attemptbadwritestr:
	.string	"attemptbadwrite"
	.globl	noattemptbadwritestr
	.align 16
	.type	noattemptbadwritestr, @object
	.size	noattemptbadwritestr, 18
noattemptbadwritestr:
	.string	"noattemptbadwrite"
	.align 8
.LC0:
	.string	"Must specify attemptbadwrite or noattemptbadwrite for first arg!\n"
	.align 8
.LC1:
	.string	"Must specify attemptwrite or noattemptwrite for first arg!\n"
.LC2:
	.string	"System page size: %zu bytes\n"
.LC3:
	.string	"Could not mmap"
.LC4:
	.string	"Could not mprotect"
	.align 8
.LC5:
	.string	"Writing 42 to the end of the unprotected twin page!"
	.align 8
.LC6:
	.string	"Reading from the end of the unprotected twin page!"
.LC7:
	.string	"Got: %lld\n"
	.align 8
.LC8:
	.string	"Writing to the beginning of the protected twin page, should crash!"
.LC9:
	.string	"Could not munmap"
	.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, 48
	mov	DWORD PTR -36[rbp], edi
	mov	QWORD PTR -48[rbp], rsi
	cmp	DWORD PTR -36[rbp], 1
	jg	.L2
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 65
	mov	esi, 1
	lea	rdi, .LC0[rip]
	call	fwrite@PLT
	mov	eax, 1
	jmp	.L3
.L2:
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	edx, 15
	lea	rsi, attemptbadwritestr[rip]
	mov	rdi, rax
	call	strncmp@PLT
	test	eax, eax
	je	.L4
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	edx, 17
	lea	rsi, noattemptbadwritestr[rip]
	mov	rdi, rax
	call	strncmp@PLT
	test	eax, eax
	je	.L4
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 59
	mov	esi, 1
	lea	rdi, .LC1[rip]
	call	fwrite@PLT
	mov	eax, 1
	jmp	.L3
.L4:
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	edx, 15
	lea	rsi, attemptbadwritestr[rip]
	mov	rdi, rax
	call	strncmp@PLT
	test	eax, eax
	sete	al
	movzx	eax, al
	mov	DWORD PTR -32[rbp], eax
	call	getpagesize@PLT
	cdqe
	mov	QWORD PTR -24[rbp], rax
	mov	rax, QWORD PTR -24[rbp]
	mov	rsi, rax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rax
	mov	r9d, 0
	mov	r8d, 0
	mov	ecx, 34
	mov	edx, 0
	mov	rsi, rax
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR -16[rbp], rax
	cmp	QWORD PTR -16[rbp], -1
	jne	.L5
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	eax, 1
	jmp	.L3
.L5:
	mov	rcx, QWORD PTR -24[rbp]
	mov	rax, QWORD PTR -16[rbp]
	mov	edx, 3
	mov	rsi, rcx
	mov	rdi, rax
	call	mprotect@PLT
	test	eax, eax
	je	.L6
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	eax, 1
	jmp	.L3
.L6:
	lea	rdi, .LC5[rip]
	call	puts@PLT
	mov	rax, QWORD PTR -24[rbp]
	lea	rdx, -8[rax]
	mov	rax, QWORD PTR -16[rbp]
	add	rax, rdx
	mov	QWORD PTR [rax], 42
	lea	rdi, .LC6[rip]
	call	puts@PLT
	mov	rax, QWORD PTR -24[rbp]
	lea	rdx, -8[rax]
	mov	rax, QWORD PTR -16[rbp]
	add	rax, rdx
	mov	rax, QWORD PTR [rax]
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -8[rbp]
	mov	rsi, rax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
	cmp	DWORD PTR -32[rbp], 0
	je	.L7
	lea	rdi, .LC8[rip]
	call	puts@PLT
	mov	rdx, QWORD PTR -16[rbp]
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	mov	BYTE PTR [rax], 73
.L7:
	mov	rax, QWORD PTR -16[rbp]
	mov	esi, 1024
	mov	rdi, rax
	call	munmap@PLT
	mov	DWORD PTR -28[rbp], eax
	cmp	DWORD PTR -28[rbp], 0
	je	.L8
	lea	rdi, .LC9[rip]
	call	perror@PLT
	mov	eax, 1
	jmp	.L3
.L8:
	cmp	QWORD PTR -8[rbp], 42
	jne	.L9
	mov	eax, 0
	jmp	.L3
.L9:
	mov	eax, 1
.L3:
	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	"591540.c"
	.text
	.global	attemptbadwritestr
	.section	.rodata
	.align	2
	.type	attemptbadwritestr, %object
	.size	attemptbadwritestr, 16
attemptbadwritestr:
	.ascii	"attemptbadwrite\000"
	.global	noattemptbadwritestr
	.align	2
	.type	noattemptbadwritestr, %object
	.size	noattemptbadwritestr, 18
noattemptbadwritestr:
	.ascii	"noattemptbadwrite\000"
	.align	2
.LC0:
	.ascii	"Must specify attemptbadwrite or noattemptbadwrite f"
	.ascii	"or first arg!\012\000"
	.align	2
.LC1:
	.ascii	"Must specify attemptwrite or noattemptwrite for fir"
	.ascii	"st arg!\012\000"
	.align	2
.LC2:
	.ascii	"System page size: %zu bytes\012\000"
	.align	2
.LC3:
	.ascii	"Could not mmap\000"
	.align	2
.LC4:
	.ascii	"Could not mprotect\000"
	.align	2
.LC5:
	.ascii	"Writing 42 to the end of the unprotected twin page!"
	.ascii	"\000"
	.align	2
.LC6:
	.ascii	"Reading from the end of the unprotected twin page!\000"
	.align	2
.LC7:
	.ascii	"Got: %lld\012\000"
	.align	2
.LC8:
	.ascii	"Writing to the beginning of the protected twin page"
	.ascii	", should crash!\000"
	.align	2
.LC9:
	.ascii	"Could not munmap\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #40
	str	r0, [fp, #-32]
	str	r1, [fp, #-36]
	ldr	r3, [fp, #-32]
	cmp	r3, #1
	bgt	.L2
	ldr	r3, .L10
	ldr	r3, [r3]
	mov	r2, #65
	mov	r1, #1
	ldr	r0, .L10+4
	bl	fwrite
	mov	r3, #1
	b	.L3
.L2:
	ldr	r3, [fp, #-36]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r2, #15
	ldr	r1, .L10+8
	mov	r0, r3
	bl	strncmp
	mov	r3, r0
	cmp	r3, #0
	beq	.L4
	ldr	r3, [fp, #-36]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r2, #17
	ldr	r1, .L10+12
	mov	r0, r3
	bl	strncmp
	mov	r3, r0
	cmp	r3, #0
	beq	.L4
	ldr	r3, .L10
	ldr	r3, [r3]
	mov	r2, #59
	mov	r1, #1
	ldr	r0, .L10+16
	bl	fwrite
	mov	r3, #1
	b	.L3
.L4:
	ldr	r3, [fp, #-36]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r2, #15
	ldr	r1, .L10+8
	mov	r0, r3
	bl	strncmp
	mov	r3, r0
	cmp	r3, #0
	moveq	r3, #1
	movne	r3, #0
	and	r3, r3, #255
	str	r3, [fp, #-28]
	bl	getpagesize
	mov	r3, r0
	str	r3, [fp, #-24]
	ldr	r1, [fp, #-24]
	ldr	r0, .L10+20
	bl	printf
	ldr	r3, [fp, #-24]
	lsl	r1, r3, #1
	mov	r3, #0
	str	r3, [sp, #4]
	mov	r3, #0
	str	r3, [sp]
	mov	r3, #34
	mov	r2, #0
	mov	r0, #0
	bl	mmap
	str	r0, [fp, #-20]
	ldr	r3, [fp, #-20]
	cmn	r3, #1
	bne	.L5
	ldr	r0, .L10+24
	bl	perror
	mov	r3, #1
	b	.L3
.L5:
	mov	r2, #3
	ldr	r1, [fp, #-24]
	ldr	r0, [fp, #-20]
	bl	mprotect
	mov	r3, r0
	cmp	r3, #0
	beq	.L6
	ldr	r0, .L10+28
	bl	perror
	mov	r3, #1
	b	.L3
.L6:
	ldr	r0, .L10+32
	bl	puts
	ldr	r3, [fp, #-24]
	sub	r3, r3, #8
	ldr	r2, [fp, #-20]
	add	r1, r2, r3
	mov	r2, #42
	mov	r3, #0
	stm	r1, {r2-r3}
	ldr	r0, .L10+36
	bl	puts
	ldr	r3, [fp, #-24]
	sub	r3, r3, #8
	ldr	r2, [fp, #-20]
	add	r3, r2, r3
	ldmia	r3, {r2-r3}
	str	r2, [fp, #-12]
	str	r3, [fp, #-8]
	sub	r3, fp, #12
	ldmia	r3, {r2-r3}
	ldr	r0, .L10+40
	bl	printf
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	beq	.L7
	ldr	r0, .L10+44
	bl	puts
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-24]
	add	r3, r2, r3
	mov	r2, #73
	strb	r2, [r3]
.L7:
	mov	r1, #1024
	ldr	r0, [fp, #-20]
	bl	munmap
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-16]
	cmp	r3, #0
	beq	.L8
	ldr	r0, .L10+48
	bl	perror
	mov	r3, #1
	b	.L3
.L8:
	sub	r3, fp, #12
	ldmia	r3, {r2-r3}
	cmp	r3, #0
	cmpeq	r2, #42
	bne	.L9
	mov	r3, #0
	b	.L3
.L9:
	mov	r3, #1
.L3:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L11:
	.align	2
.L10:
	.word	stderr
	.word	.LC0
	.word	attemptbadwritestr
	.word	noattemptbadwritestr
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
