	.file	"291517.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"Out of memory\n"
	.text
	.type	xmalloc, @function
xmalloc:
.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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR -8[rbp], rax
	cmp	QWORD PTR -8[rbp], 0
	jne	.L2
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 14
	mov	esi, 1
	lea	rdi, .LC0[rip]
	call	fwrite@PLT
	call	abort@PLT
.L2:
	mov	rax, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	xmalloc, .-xmalloc
	.type	sgets, @function
sgets:
.LFB7:
	.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 -24[rbp], rdi
	mov	QWORD PTR -32[rbp], rsi
	mov	QWORD PTR -40[rbp], rdx
	mov	rax, QWORD PTR -40[rbp]
	mov	rax, QWORD PTR [rax]
	mov	QWORD PTR -16[rbp], rax
	mov	QWORD PTR -8[rbp], 0
	jmp	.L5
.L8:
	mov	rax, QWORD PTR -16[rbp]
	movzx	eax, BYTE PTR [rax]
	cmp	al, 10
	jne	.L6
	add	QWORD PTR -16[rbp], 1
	add	QWORD PTR -8[rbp], 1
	jmp	.L7
.L6:
	mov	rdx, QWORD PTR -16[rbp]
	lea	rax, 1[rdx]
	mov	QWORD PTR -16[rbp], rax
	mov	rax, QWORD PTR -24[rbp]
	lea	rcx, 1[rax]
	mov	QWORD PTR -24[rbp], rcx
	movzx	edx, BYTE PTR [rdx]
	mov	BYTE PTR [rax], dl
	add	QWORD PTR -8[rbp], 1
.L5:
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 1
	cmp	QWORD PTR -32[rbp], rax
	jbe	.L7
	mov	rax, QWORD PTR -16[rbp]
	movzx	eax, BYTE PTR [rax]
	test	al, al
	jne	.L8
.L7:
	cmp	QWORD PTR -8[rbp], 0
	jne	.L9
	mov	eax, 0
	jmp	.L10
.L9:
	mov	rax, QWORD PTR -24[rbp]
	mov	BYTE PTR [rax], 0
	mov	rax, QWORD PTR -40[rbp]
	mov	rdx, QWORD PTR -16[rbp]
	mov	QWORD PTR [rax], rdx
	mov	rax, QWORD PTR -24[rbp]
.L10:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	sgets, .-sgets
	.section	.rodata
.LC1:
	.string	"Usage: %s [games directory]\n"
	.text
	.type	usage, @function
usage:
.LFB8:
	.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
	mov	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR stderr[rip]
	mov	rdx, QWORD PTR -8[rbp]
	lea	rsi, .LC1[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	usage, .-usage
	.type	check_for_games, @function
check_for_games:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 176
	mov	QWORD PTR -168[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rdx, -160[rbp]
	mov	rax, QWORD PTR -168[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	stat@PLT
	test	eax, eax
	jne	.L14
	mov	eax, DWORD PTR -136[rbp]
	and	eax, 61440
	cmp	eax, 16384
	jne	.L14
	mov	eax, 1
	jmp	.L16
.L14:
	mov	eax, 0
.L16:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	check_for_games, .-check_for_games
	.section	.rodata
.LC2:
	.string	"%s/%s/%s.desktop"
	.text
	.type	is_game_path, @function
is_game_path:
.LFB10:
	.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, 176
	mov	QWORD PTR -4264[rbp], rdi
	mov	QWORD PTR -4272[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rsi, QWORD PTR -4272[rbp]
	mov	rcx, QWORD PTR -4272[rbp]
	mov	rdx, QWORD PTR -4264[rbp]
	lea	rax, -4112[rbp]
	mov	r9, rsi
	mov	r8, rcx
	mov	rcx, rdx
	lea	rdx, .LC2[rip]
	mov	esi, 4096
	mov	rdi, rax
	mov	eax, 0
	call	snprintf@PLT
	lea	rdx, -4256[rbp]
	lea	rax, -4112[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	stat@PLT
	test	eax, eax
	jne	.L19
	mov	eax, DWORD PTR -4232[rbp]
	and	eax, 61440
	cmp	eax, 32768
	jne	.L19
	mov	eax, 1
	jmp	.L21
.L19:
	mov	eax, 0
.L21:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	is_game_path, .-is_game_path
	.section	.rodata
.LC3:
	.string	"%s/%s/%s.patched"
.LC4:
	.string	"rb"
	.align 8
.LC5:
	.string	"Failed to open game '%s' configuration for reading [%s]\n"
.LC6:
	.string	"wb"
	.align 8
.LC7:
	.string	"Failed to open game '%s' configuration for writing [%s]\n"
	.align 8
.LC8:
	.string	"Failed to read game '%s' configuration [%s]\n"
.LC9:
	.string	"Exec="
.LC10:
	.string	"--retroarch"
.LC11:
	.string	"Name="
	.align 8
.LC12:
	.string	"Patched game '%s' which is '%s'\n"
	.align 8
.LC13:
	.string	"Ignored game '%s' which is '%s' since it's already patched\n"
.LC14:
	.string	"r"
	.text
	.type	apply_retroarch_to_game, @function
apply_retroarch_to_game:
.LFB11:
	.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, 4096
	or	QWORD PTR [rsp], 0
	sub	rsp, 4096
	or	QWORD PTR [rsp], 0
	sub	rsp, 96
	mov	QWORD PTR -12376[rbp], rdi
	mov	QWORD PTR -12384[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rsi, QWORD PTR -12384[rbp]
	mov	rcx, QWORD PTR -12384[rbp]
	mov	rdx, QWORD PTR -12376[rbp]
	lea	rax, -12304[rbp]
	mov	r9, rsi
	mov	r8, rcx
	mov	rcx, rdx
	lea	rdx, .LC2[rip]
	mov	esi, 4096
	mov	rdi, rax
	mov	eax, 0
	call	snprintf@PLT
	mov	rsi, QWORD PTR -12384[rbp]
	mov	rcx, QWORD PTR -12384[rbp]
	mov	rdx, QWORD PTR -12376[rbp]
	lea	rax, -8208[rbp]
	mov	r9, rsi
	mov	r8, rcx
	mov	rcx, rdx
	lea	rdx, .LC3[rip]
	mov	esi, 4096
	mov	rdi, rax
	mov	eax, 0
	call	snprintf@PLT
	lea	rax, -12304[rbp]
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -12344[rbp], rax
	cmp	QWORD PTR -12344[rbp], 0
	jne	.L24
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rcx, rax
	mov	rax, QWORD PTR stderr[rip]
	mov	rdx, QWORD PTR -12384[rbp]
	lea	rsi, .LC5[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	eax, 0
	jmp	.L37
.L24:
	lea	rax, -8208[rbp]
	lea	rsi, .LC6[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -12336[rbp], rax
	cmp	QWORD PTR -12336[rbp], 0
	jne	.L26
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rcx, rax
	mov	rax, QWORD PTR stderr[rip]
	mov	rdx, QWORD PTR -12384[rbp]
	lea	rsi, .LC7[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	rax, QWORD PTR -12344[rbp]
	mov	rdi, rax
	call	fclose@PLT
	mov	eax, 0
	jmp	.L37
.L26:
	mov	rax, QWORD PTR -12344[rbp]
	mov	edx, 2
	mov	esi, 0
	mov	rdi, rax
	call	fseek@PLT
	mov	rax, QWORD PTR -12344[rbp]
	mov	rdi, rax
	call	ftell@PLT
	mov	QWORD PTR -12328[rbp], rax
	mov	rax, QWORD PTR -12344[rbp]
	mov	edx, 0
	mov	esi, 0
	mov	rdi, rax
	call	fseek@PLT
	mov	rax, QWORD PTR -12328[rbp]
	mov	rdi, rax
	call	xmalloc
	mov	QWORD PTR -12320[rbp], rax
	mov	rsi, QWORD PTR -12328[rbp]
	mov	rdx, QWORD PTR -12344[rbp]
	mov	rax, QWORD PTR -12320[rbp]
	mov	rcx, rdx
	mov	edx, 1
	mov	rdi, rax
	call	fread@PLT
	cmp	rax, 1
	je	.L27
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rcx, rax
	mov	rax, QWORD PTR stderr[rip]
	mov	rdx, QWORD PTR -12384[rbp]
	lea	rsi, .LC8[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	rax, QWORD PTR -12344[rbp]
	mov	rdi, rax
	call	fclose@PLT
	mov	rax, QWORD PTR -12336[rbp]
	mov	rdi, rax
	call	fclose@PLT
	mov	eax, 0
	jmp	.L37
.L27:
	mov	rax, QWORD PTR -12344[rbp]
	mov	rdi, rax
	call	fclose@PLT
	mov	rax, QWORD PTR -12320[rbp]
	mov	QWORD PTR -12352[rbp], rax
	mov	BYTE PTR -12353[rbp], 0
	jmp	.L28
.L33:
	lea	rax, -4112[rbp]
	mov	edx, 5
	lea	rsi, .LC9[rip]
	mov	rdi, rax
	call	strncmp@PLT
	test	eax, eax
	jne	.L29
	lea	rax, -4112[rbp]
	lea	rsi, .LC10[rip]
	mov	rdi, rax
	call	strstr@PLT
	test	rax, rax
	je	.L30
	mov	BYTE PTR -12353[rbp], 0
	jmp	.L31
.L30:
	lea	rax, -4112[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	rdx, rax
	lea	rax, -4112[rbp]
	add	rax, rdx
	movabs	rcx, 8030609064611097888
	mov	QWORD PTR [rax], rcx
	mov	DWORD PTR 8[rax], 1751347809
	mov	BYTE PTR 12[rax], 0
	mov	BYTE PTR -12353[rbp], 1
	jmp	.L31
.L29:
	lea	rax, -4112[rbp]
	mov	edx, 5
	lea	rsi, .LC11[rip]
	mov	rdi, rax
	call	strncmp@PLT
	test	eax, eax
	jne	.L31
	cmp	BYTE PTR -12353[rbp], 0
	je	.L32
	lea	rax, -4112[rbp]
	add	rax, 5
	mov	rcx, QWORD PTR -12384[rbp]
	mov	rdx, rax
	mov	rsi, rcx
	lea	rdi, .LC12[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L31
.L32:
	lea	rax, -4112[rbp]
	add	rax, 5
	mov	rcx, QWORD PTR -12384[rbp]
	mov	rdx, rax
	mov	rsi, rcx
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
.L31:
	lea	rax, -4112[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	rsi, rax
	mov	rdx, QWORD PTR -12336[rbp]
	lea	rax, -4112[rbp]
	mov	rcx, rdx
	mov	edx, 1
	mov	rdi, rax
	call	fwrite@PLT
	mov	BYTE PTR -12354[rbp], 10
	mov	rdx, QWORD PTR -12336[rbp]
	lea	rax, -12354[rbp]
	mov	rcx, rdx
	mov	edx, 1
	mov	esi, 1
	mov	rdi, rax
	call	fwrite@PLT
.L28:
	lea	rdx, -12352[rbp]
	lea	rax, -4112[rbp]
	mov	esi, 4096
	mov	rdi, rax
	call	sgets
	test	rax, rax
	jne	.L33
	mov	rax, QWORD PTR -12336[rbp]
	mov	rdi, rax
	call	fclose@PLT
	mov	rax, QWORD PTR -12320[rbp]
	mov	rdi, rax
	call	free@PLT
	lea	rax, -12304[rbp]
	mov	rdi, rax
	call	remove@PLT
.L36:
	lea	rax, -12304[rbp]
	lea	rsi, .LC14[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -12312[rbp], rax
	cmp	QWORD PTR -12312[rbp], 0
	je	.L40
	mov	rax, QWORD PTR -12312[rbp]
	mov	rdi, rax
	call	fclose@PLT
	jmp	.L36
.L40:
	nop
	lea	rdx, -12304[rbp]
	lea	rax, -8208[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	rename@PLT
	test	eax, eax
	sete	al
.L37:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L38
	call	__stack_chk_fail@PLT
.L38:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	apply_retroarch_to_game, .-apply_retroarch_to_game
	.section	.rodata
.LC15:
	.string	"Patched %d of %d games\n"
.LC16:
	.string	"No games found"
	.text
	.type	apply_retroarch_to_games, @function
apply_retroarch_to_games:
.LFB12:
	.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	QWORD PTR -40[rbp], rdi
	mov	rax, QWORD PTR -40[rbp]
	mov	rdi, rax
	call	opendir@PLT
	mov	QWORD PTR -16[rbp], rax
	cmp	QWORD PTR -16[rbp], 0
	jne	.L42
	mov	eax, 0
	jmp	.L43
.L42:
	mov	QWORD PTR -8[rbp], 0
	mov	DWORD PTR -24[rbp], 0
	mov	DWORD PTR -20[rbp], 0
	jmp	.L44
.L47:
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR 18[rax]
	cmp	al, 4
	jne	.L44
	mov	rax, QWORD PTR -8[rbp]
	lea	rdx, 19[rax]
	mov	rax, QWORD PTR -40[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	is_game_path
	xor	eax, 1
	test	al, al
	je	.L46
	jmp	.L44
.L46:
	add	DWORD PTR -24[rbp], 1
	mov	rax, QWORD PTR -8[rbp]
	lea	rdx, 19[rax]
	mov	rax, QWORD PTR -40[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	apply_retroarch_to_game
	test	al, al
	je	.L44
	add	DWORD PTR -20[rbp], 1
.L44:
	mov	rax, QWORD PTR -16[rbp]
	mov	rdi, rax
	call	readdir@PLT
	mov	QWORD PTR -8[rbp], rax
	cmp	QWORD PTR -8[rbp], 0
	jne	.L47
	mov	rax, QWORD PTR -16[rbp]
	mov	rdi, rax
	call	closedir@PLT
	cmp	DWORD PTR -24[rbp], 0
	je	.L48
	mov	edx, DWORD PTR -24[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC15[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L49
.L48:
	lea	rdi, .LC16[rip]
	call	puts@PLT
.L49:
	mov	eax, DWORD PTR -24[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	sete	al
.L43:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	apply_retroarch_to_games, .-apply_retroarch_to_games
	.section	.rodata
	.align 8
.LC17:
	.string	"Could not find games directory '%s' [%s]\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB13:
	.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
	mov	DWORD PTR -4[rbp], edi
	mov	QWORD PTR -16[rbp], rsi
	cmp	DWORD PTR -4[rbp], 2
	je	.L51
	mov	rax, QWORD PTR -16[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	usage
	jmp	.L52
.L51:
	mov	rax, QWORD PTR -16[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	check_for_games
	xor	eax, 1
	test	al, al
	je	.L53
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rcx, rax
	mov	rax, QWORD PTR -16[rbp]
	add	rax, 8
	mov	rdx, QWORD PTR [rax]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC17[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	eax, 0
	jmp	.L52
.L53:
	mov	rax, QWORD PTR -16[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	apply_retroarch_to_games
	movzx	eax, al
.L52:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.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	"291517.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Out of memory\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	xmalloc, %function
xmalloc:
	@ 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]
	ldr	r0, [fp, #-16]
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L2
	ldr	r3, .L4
	ldr	r3, [r3]
	mov	r2, #14
	mov	r1, #1
	ldr	r0, .L4+4
	bl	fwrite
	bl	abort
.L2:
	ldr	r3, [fp, #-8]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L5:
	.align	2
.L4:
	.word	stderr
	.word	.LC0
	.size	xmalloc, .-xmalloc
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	sgets, %function
sgets:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #28
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	str	r2, [fp, #-24]
	ldr	r3, [fp, #-24]
	ldr	r3, [r3]
	str	r3, [fp, #-12]
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L7
.L10:
	ldr	r3, [fp, #-12]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #10
	bne	.L8
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
	b	.L9
.L8:
	ldr	r2, [fp, #-12]
	add	r3, r2, #1
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-16]
	add	r1, r3, #1
	str	r1, [fp, #-16]
	ldrb	r2, [r2]	@ zero_extendqisi2
	strb	r2, [r3]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L7:
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	ldr	r2, [fp, #-20]
	cmp	r2, r3
	bls	.L9
	ldr	r3, [fp, #-12]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	bne	.L10
.L9:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L11
	mov	r3, #0
	b	.L12
.L11:
	ldr	r3, [fp, #-16]
	mov	r2, #0
	strb	r2, [r3]
	ldr	r3, [fp, #-24]
	ldr	r2, [fp, #-12]
	str	r2, [r3]
	ldr	r3, [fp, #-16]
.L12:
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
	.size	sgets, .-sgets
	.section	.rodata
	.align	2
.LC1:
	.ascii	"Usage: %s [games directory]\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	usage, %function
usage:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r3, .L15
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	ldr	r1, .L15+4
	mov	r0, r3
	bl	fprintf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L16:
	.align	2
.L15:
	.word	stderr
	.word	.LC1
	.size	usage, .-usage
	.section	.rodata
	.align	2
.LC2:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	check_for_games, %function
check_for_games:
	@ args = 0, pretend = 0, frame = 104
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #104
	str	r0, [fp, #-104]
	ldr	r3, .L22
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	sub	r3, fp, #100
	mov	r1, r3
	ldr	r0, [fp, #-104]
	bl	stat
	mov	r3, r0
	cmp	r3, #0
	bne	.L18
	ldr	r3, [fp, #-84]
	and	r3, r3, #61440
	cmp	r3, #16384
	bne	.L18
	mov	r3, #1
	b	.L20
.L18:
	mov	r3, #0
.L20:
	ldr	r2, .L22
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L21
	bl	__stack_chk_fail
.L21:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L23:
	.align	2
.L22:
	.word	.LC2
	.size	check_for_games, .-check_for_games
	.section	.rodata
	.align	2
.LC3:
	.ascii	"%s/%s/%s.desktop\000"
	.align	2
.LC4:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	is_game_path, %function
is_game_path:
	@ args = 0, pretend = 0, frame = 4200
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #4160
	sub	sp, sp, #48
	sub	r3, fp, #4096
	sub	r3, r3, #4
	str	r0, [r3, #-100]
	sub	r3, fp, #4096
	sub	r3, r3, #4
	str	r1, [r3, #-104]
	ldr	r3, .L29
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	sub	r3, fp, #4096
	sub	r3, r3, #4
	mov	r2, r3
	sub	r0, fp, #4096
	sub	r0, r0, #4
	sub	r0, r0, #4
	sub	r3, fp, #4096
	sub	r3, r3, #4
	ldr	r3, [r3, #-104]
	str	r3, [sp, #4]
	sub	r3, fp, #4096
	sub	r3, r3, #4
	ldr	r3, [r3, #-104]
	str	r3, [sp]
	ldr	r3, [r2, #-100]
	ldr	r2, .L29+4
	mov	r1, #4096
	bl	snprintf
	sub	r2, fp, #4160
	sub	r2, r2, #4
	sub	r2, r2, #32
	sub	r3, fp, #4096
	sub	r3, r3, #4
	sub	r3, r3, #4
	mov	r1, r2
	mov	r0, r3
	bl	stat
	mov	r3, r0
	cmp	r3, #0
	bne	.L25
	sub	r3, fp, #4096
	sub	r3, r3, #4
	ldr	r3, [r3, #-80]
	and	r3, r3, #61440
	cmp	r3, #32768
	bne	.L25
	mov	r3, #1
	b	.L27
.L25:
	mov	r3, #0
.L27:
	ldr	r2, .L29
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L28
	bl	__stack_chk_fail
.L28:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L30:
	.align	2
.L29:
	.word	.LC4
	.word	.LC3
	.size	is_game_path, .-is_game_path
	.section	.rodata
	.align	2
.LC5:
	.ascii	"%s/%s/%s.patched\000"
	.align	2
.LC6:
	.ascii	"rb\000"
	.align	2
.LC7:
	.ascii	"Failed to open game '%s' configuration for reading "
	.ascii	"[%s]\012\000"
	.align	2
.LC8:
	.ascii	"wb\000"
	.align	2
.LC9:
	.ascii	"Failed to open game '%s' configuration for writing "
	.ascii	"[%s]\012\000"
	.align	2
.LC10:
	.ascii	"Failed to read game '%s' configuration [%s]\012\000"
	.align	2
.LC11:
	.ascii	"Exec=\000"
	.align	2
.LC12:
	.ascii	"--retroarch\000"
	.align	2
.LC13:
	.ascii	" --retroarch\000"
	.align	2
.LC14:
	.ascii	"Name=\000"
	.align	2
.LC15:
	.ascii	"Patched game '%s' which is '%s'\012\000"
	.align	2
.LC16:
	.ascii	"Ignored game '%s' which is '%s' since it's already "
	.ascii	"patched\012\000"
	.align	2
.LC17:
	.ascii	"r\000"
	.align	2
.LC18:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	apply_retroarch_to_game, %function
apply_retroarch_to_game:
	@ args = 0, pretend = 0, frame = 12328
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #12288
	sub	sp, sp, #52
	sub	r3, fp, #12288
	sub	r3, r3, #12
	str	r0, [r3, #-36]
	sub	r3, fp, #12288
	sub	r3, r3, #12
	str	r1, [r3, #-40]
	ldr	r3, .L49
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r2, r3
	sub	r0, fp, #12288
	sub	r0, r0, #12
	sub	r0, r0, #4
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r3, [r3, #-40]
	str	r3, [sp, #4]
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r3, [r3, #-40]
	str	r3, [sp]
	ldr	r3, [r2, #-36]
	ldr	r2, .L49+4
	mov	r1, #4096
	bl	snprintf
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r2, r3
	sub	r0, fp, #8192
	sub	r0, r0, #12
	sub	r0, r0, #4
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r3, [r3, #-40]
	str	r3, [sp, #4]
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r3, [r3, #-40]
	str	r3, [sp]
	ldr	r3, [r2, #-36]
	ldr	r2, .L49+8
	mov	r1, #4096
	bl	snprintf
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #12288
	sub	r3, r3, #12
	sub	r3, r3, #4
	ldr	r1, .L49+12
	mov	r0, r3
	bl	fopen
	str	r0, [r4, #-24]
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r3, [r3, #-24]
	cmp	r3, #0
	bne	.L32
	ldr	r3, .L49+16
	ldr	r4, [r3]
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	sub	r2, fp, #12288
	sub	r2, r2, #12
	ldr	r2, [r2, #-40]
	ldr	r1, .L49+20
	mov	r0, r4
	bl	fprintf
	mov	r3, #0
	b	.L45
.L32:
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	sub	r3, r3, #4
	ldr	r1, .L49+24
	mov	r0, r3
	bl	fopen
	str	r0, [r4, #-20]
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r3, [r3, #-20]
	cmp	r3, #0
	bne	.L34
	ldr	r3, .L49+16
	ldr	r4, [r3]
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	sub	r2, fp, #12288
	sub	r2, r2, #12
	ldr	r2, [r2, #-40]
	ldr	r1, .L49+28
	mov	r0, r4
	bl	fprintf
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r0, [r3, #-24]
	bl	fclose
	mov	r3, #0
	b	.L45
.L34:
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r2, #2
	mov	r1, #0
	ldr	r0, [r3, #-24]
	bl	fseek
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r0, [r3, #-24]
	bl	ftell
	str	r0, [r4, #-16]
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [r3, #-24]
	bl	fseek
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r3, [r3, #-16]
	sub	r2, fp, #12288
	sub	r2, r2, #12
	mov	r4, r2
	mov	r0, r3
	bl	xmalloc
	str	r0, [r4, #-12]
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r1, [r3, #-16]
	sub	r3, fp, #12288
	sub	r3, r3, #12
	sub	r2, fp, #12288
	sub	r2, r2, #12
	mov	r0, r2
	ldr	r3, [r3, #-24]
	mov	r2, #1
	ldr	r0, [r0, #-12]
	bl	fread
	mov	r3, r0
	cmp	r3, #1
	beq	.L35
	ldr	r3, .L49+16
	ldr	r4, [r3]
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	sub	r2, fp, #12288
	sub	r2, r2, #12
	ldr	r2, [r2, #-40]
	ldr	r1, .L49+32
	mov	r0, r4
	bl	fprintf
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r0, [r3, #-24]
	bl	fclose
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r0, [r3, #-20]
	bl	fclose
	mov	r3, #0
	b	.L45
.L35:
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r0, [r3, #-24]
	bl	fclose
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r3, [r3, #-12]
	str	r3, [r2, #-28]
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r2, #0
	strb	r2, [r3, #-29]
	b	.L36
.L41:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r2, #5
	ldr	r1, .L49+36
	mov	r0, r3
	bl	strncmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L37
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	ldr	r1, .L49+40
	mov	r0, r3
	bl	strstr
	mov	r3, r0
	cmp	r3, #0
	beq	.L38
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r2, #0
	strb	r2, [r3, #-29]
	b	.L39
.L38:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r0, r3
	bl	strlen
	mov	r3, r0
	mov	r2, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	add	r3, r3, r2
	ldr	r2, .L49+44
	mov	r0, r3
	mov	r1, r2
	mov	r3, #13
	mov	r2, r3
	bl	memcpy
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r2, #1
	strb	r2, [r3, #-29]
	b	.L39
.L37:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r2, #5
	ldr	r1, .L49+48
	mov	r0, r3
	bl	strncmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L39
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldrb	r3, [r3, #-29]	@ zero_extendqisi2
	cmp	r3, #0
	beq	.L40
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	add	r3, r3, #5
	sub	r2, fp, #12288
	sub	r2, r2, #12
	mov	r1, r2
	mov	r2, r3
	ldr	r1, [r1, #-40]
	ldr	r0, .L49+52
	bl	printf
	b	.L39
.L40:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	add	r3, r3, #5
	sub	r2, fp, #12288
	sub	r2, r2, #12
	mov	r1, r2
	mov	r2, r3
	ldr	r1, [r1, #-40]
	ldr	r0, .L49+56
	bl	printf
.L39:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r0, r3
	bl	strlen
	mov	r1, r0
	sub	r3, fp, #12288
	sub	r3, r3, #12
	sub	r0, fp, #4096
	sub	r0, r0, #12
	sub	r0, r0, #4
	ldr	r3, [r3, #-20]
	mov	r2, #1
	bl	fwrite
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r2, #10
	strb	r2, [r3, #-30]
	sub	r3, fp, #12288
	sub	r3, r3, #12
	sub	r0, fp, #12288
	sub	r0, r0, #12
	sub	r0, r0, #30
	ldr	r3, [r3, #-20]
	mov	r2, #1
	mov	r1, #1
	bl	fwrite
.L36:
	sub	r2, fp, #12288
	sub	r2, r2, #12
	sub	r2, r2, #28
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r1, #4096
	mov	r0, r3
	bl	sgets
	mov	r3, r0
	cmp	r3, #0
	bne	.L41
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r0, [r3, #-20]
	bl	fclose
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r0, [r3, #-12]
	bl	free
	sub	r3, fp, #12288
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r0, r3
	bl	remove
.L44:
	sub	r3, fp, #12288
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #12288
	sub	r3, r3, #12
	sub	r3, r3, #4
	ldr	r1, .L49+60
	mov	r0, r3
	bl	fopen
	str	r0, [r4, #-8]
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r3, [r3, #-8]
	cmp	r3, #0
	beq	.L48
	sub	r3, fp, #12288
	sub	r3, r3, #12
	ldr	r0, [r3, #-8]
	bl	fclose
	b	.L44
.L48:
	nop
	sub	r2, fp, #12288
	sub	r2, r2, #12
	sub	r2, r2, #4
	sub	r3, fp, #8192
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r1, r2
	mov	r0, r3
	bl	rename
	mov	r3, r0
	cmp	r3, #0
	moveq	r3, #1
	movne	r3, #0
	and	r3, r3, #255
.L45:
	ldr	r2, .L49
	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}
.L50:
	.align	2
.L49:
	.word	.LC18
	.word	.LC3
	.word	.LC5
	.word	.LC6
	.word	stderr
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.word	.LC13
	.word	.LC14
	.word	.LC15
	.word	.LC16
	.word	.LC17
	.size	apply_retroarch_to_game, .-apply_retroarch_to_game
	.section	.rodata
	.align	2
.LC19:
	.ascii	"Patched %d of %d games\012\000"
	.align	2
.LC20:
	.ascii	"No games found\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	apply_retroarch_to_games, %function
apply_retroarch_to_games:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-24]
	ldr	r0, [fp, #-24]
	bl	opendir
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bne	.L52
	mov	r3, #0
	b	.L53
.L52:
	mov	r3, #0
	str	r3, [fp, #-8]
	mov	r3, #0
	str	r3, [fp, #-20]
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L54
.L57:
	ldr	r3, [fp, #-8]
	ldrb	r3, [r3, #10]	@ zero_extendqisi2
	cmp	r3, #4
	bne	.L54
	ldr	r3, [fp, #-8]
	add	r3, r3, #11
	mov	r1, r3
	ldr	r0, [fp, #-24]
	bl	is_game_path
	mov	r3, r0
	eor	r3, r3, #1
	and	r3, r3, #255
	cmp	r3, #0
	beq	.L56
	b	.L54
.L56:
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
	ldr	r3, [fp, #-8]
	add	r3, r3, #11
	mov	r1, r3
	ldr	r0, [fp, #-24]
	bl	apply_retroarch_to_game
	mov	r3, r0
	cmp	r3, #0
	beq	.L54
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L54:
	ldr	r0, [fp, #-12]
	bl	readdir
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L57
	ldr	r0, [fp, #-12]
	bl	closedir
	ldr	r3, [fp, #-20]
	cmp	r3, #0
	beq	.L58
	ldr	r2, [fp, #-20]
	ldr	r1, [fp, #-16]
	ldr	r0, .L60
	bl	printf
	b	.L59
.L58:
	ldr	r0, .L60+4
	bl	puts
.L59:
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	moveq	r3, #1
	movne	r3, #0
	and	r3, r3, #255
.L53:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L61:
	.align	2
.L60:
	.word	.LC19
	.word	.LC20
	.size	apply_retroarch_to_games, .-apply_retroarch_to_games
	.section	.rodata
	.align	2
.LC21:
	.ascii	"Could not find games directory '%s' [%s]\012\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, fp, lr}
	add	fp, sp, #12
	sub	sp, sp, #8
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	ldr	r3, [fp, #-16]
	cmp	r3, #2
	beq	.L63
	ldr	r3, [fp, #-20]
	ldr	r3, [r3]
	mov	r0, r3
	bl	usage
	mov	r3, r0
	b	.L64
.L63:
	ldr	r3, [fp, #-20]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	check_for_games
	mov	r3, r0
	eor	r3, r3, #1
	and	r3, r3, #255
	cmp	r3, #0
	beq	.L65
	ldr	r3, .L66
	ldr	r4, [r3]
	ldr	r3, [fp, #-20]
	add	r3, r3, #4
	ldr	r5, [r3]
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	mov	r2, r5
	ldr	r1, .L66+4
	mov	r0, r4
	bl	fprintf
	mov	r3, #0
	b	.L64
.L65:
	ldr	r3, [fp, #-20]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	apply_retroarch_to_games
	mov	r3, r0
.L64:
	mov	r0, r3
	sub	sp, fp, #12
	@ sp needed
	pop	{r4, r5, fp, pc}
.L67:
	.align	2
.L66:
	.word	stderr
	.word	.LC21
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
