	.file	"472518.c"
	.intel_syntax noprefix
	.text
	.globl	ifp
	.bss
	.align 8
	.type	ifp, @object
	.size	ifp, 8
ifp:
	.zero	8
	.globl	ofp
	.align 8
	.type	ofp, @object
	.size	ofp, 8
ofp:
	.zero	8
	.globl	input_name
	.align 8
	.type	input_name, @object
	.size	input_name, 8
input_name:
	.zero	8
	.globl	output_name
	.align 8
	.type	output_name, @object
	.size	output_name, 8
output_name:
	.zero	8
	.globl	input_data
	.align 8
	.type	input_data, @object
	.size	input_data, 8
input_data:
	.zero	8
	.globl	output_data
	.align 8
	.type	output_data, @object
	.size	output_data, 8
output_data:
	.zero	8
	.globl	input_index
	.align 8
	.type	input_index, @object
	.size	input_index, 8
input_index:
	.zero	8
	.globl	output_index
	.align 8
	.type	output_index, @object
	.size	output_index, 8
output_index:
	.zero	8
	.globl	input_size
	.align 8
	.type	input_size, @object
	.size	input_size, 8
input_size:
	.zero	8
	.globl	output_size
	.align 8
	.type	output_size, @object
	.size	output_size, 8
output_size:
	.zero	8
	.globl	partial_counter
	.align 8
	.type	partial_counter, @object
	.size	partial_counter, 8
partial_counter:
	.zero	8
	.globl	bit_mask
	.align 4
	.type	bit_mask, @object
	.size	bit_mask, 4
bit_mask:
	.zero	4
	.globl	bit_value
	.align 4
	.type	bit_value, @object
	.size	bit_value, 4
bit_value:
	.zero	4
	.section	.rodata
	.align 8
.LC0:
	.string	"Error: Truncated input file %s\n"
.LC1:
	.string	"Error: Empty input file %s\n"
	.text
	.globl	read_byte
	.type	read_byte, @function
read_byte:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	rdx, QWORD PTR input_index[rip]
	mov	rax, QWORD PTR partial_counter[rip]
	cmp	rdx, rax
	jne	.L2
	mov	QWORD PTR input_index[rip], 0
	mov	rdx, QWORD PTR ifp[rip]
	mov	rax, QWORD PTR input_data[rip]
	mov	rcx, rdx
	mov	edx, 16384
	mov	esi, 1
	mov	rdi, rax
	call	fread@PLT
	mov	QWORD PTR partial_counter[rip], rax
	mov	rdx, QWORD PTR input_size[rip]
	mov	rax, QWORD PTR partial_counter[rip]
	add	rax, rdx
	mov	QWORD PTR input_size[rip], rax
	mov	rax, QWORD PTR partial_counter[rip]
	test	rax, rax
	jne	.L2
	mov	rdx, QWORD PTR input_name[rip]
	mov	rax, QWORD PTR input_size[rip]
	test	rax, rax
	je	.L3
	lea	rax, .LC0[rip]
	jmp	.L4
.L3:
	lea	rax, .LC1[rip]
.L4:
	mov	rcx, QWORD PTR stderr[rip]
	mov	rsi, rax
	mov	rdi, rcx
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
.L2:
	mov	rcx, QWORD PTR input_data[rip]
	mov	rax, QWORD PTR input_index[rip]
	lea	rdx, 1[rax]
	mov	QWORD PTR input_index[rip], rdx
	add	rax, rcx
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	read_byte, .-read_byte
	.globl	read_bit
	.type	read_bit, @function
read_bit:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	eax, DWORD PTR bit_mask[rip]
	sar	eax
	mov	DWORD PTR bit_mask[rip], eax
	mov	eax, DWORD PTR bit_mask[rip]
	test	eax, eax
	jne	.L7
	mov	DWORD PTR bit_mask[rip], 128
	mov	eax, 0
	call	read_byte
	mov	DWORD PTR bit_value[rip], eax
.L7:
	mov	edx, DWORD PTR bit_value[rip]
	mov	eax, DWORD PTR bit_mask[rip]
	and	eax, edx
	test	eax, eax
	setne	al
	movzx	eax, al
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	read_bit, .-read_bit
	.globl	read_elias_gamma
	.type	read_elias_gamma, @function
read_elias_gamma:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	rbx
	sub	rsp, 24
	.cfi_offset 3, -24
	mov	DWORD PTR -24[rbp], 0
	jmp	.L10
.L11:
	add	DWORD PTR -24[rbp], 1
.L10:
	mov	eax, 0
	call	read_bit
	test	eax, eax
	je	.L11
	cmp	DWORD PTR -24[rbp], 15
	jle	.L12
	mov	eax, -1
	jmp	.L13
.L12:
	mov	DWORD PTR -20[rbp], 1
	jmp	.L14
.L15:
	mov	eax, DWORD PTR -20[rbp]
	lea	ebx, [rax+rax]
	mov	eax, 0
	call	read_bit
	or	eax, ebx
	mov	DWORD PTR -20[rbp], eax
.L14:
	mov	eax, DWORD PTR -24[rbp]
	lea	edx, -1[rax]
	mov	DWORD PTR -24[rbp], edx
	test	eax, eax
	jne	.L15
	mov	eax, DWORD PTR -20[rbp]
.L13:
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	read_elias_gamma, .-read_elias_gamma
	.globl	read_offset
	.type	read_offset, @function
read_offset:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	rbx
	sub	rsp, 24
	.cfi_offset 3, -24
	mov	eax, 0
	call	read_byte
	mov	DWORD PTR -24[rbp], eax
	cmp	DWORD PTR -24[rbp], 127
	jg	.L17
	mov	eax, DWORD PTR -24[rbp]
	jmp	.L18
.L17:
	mov	eax, 0
	call	read_bit
	mov	DWORD PTR -20[rbp], eax
	mov	eax, DWORD PTR -20[rbp]
	lea	ebx, [rax+rax]
	mov	eax, 0
	call	read_bit
	or	eax, ebx
	mov	DWORD PTR -20[rbp], eax
	mov	eax, DWORD PTR -20[rbp]
	lea	ebx, [rax+rax]
	mov	eax, 0
	call	read_bit
	or	eax, ebx
	mov	DWORD PTR -20[rbp], eax
	mov	eax, DWORD PTR -20[rbp]
	lea	ebx, [rax+rax]
	mov	eax, 0
	call	read_bit
	or	eax, ebx
	mov	DWORD PTR -20[rbp], eax
	mov	eax, DWORD PTR -24[rbp]
	and	eax, 127
	mov	edx, eax
	mov	eax, DWORD PTR -20[rbp]
	sal	eax, 7
	or	eax, edx
	sub	eax, -128
.L18:
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	read_offset, .-read_offset
	.section	.rodata
	.align 8
.LC2:
	.string	"Error: Cannot write output file %s\n"
	.text
	.globl	save_output
	.type	save_output, @function
save_output:
.LFB10:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	rax, QWORD PTR output_index[rip]
	test	rax, rax
	je	.L22
	mov	rcx, QWORD PTR ofp[rip]
	mov	rdx, QWORD PTR output_index[rip]
	mov	rax, QWORD PTR output_data[rip]
	mov	esi, 1
	mov	rdi, rax
	call	fwrite@PLT
	mov	rdx, QWORD PTR output_index[rip]
	cmp	rax, rdx
	je	.L21
	mov	rdx, QWORD PTR output_name[rip]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC2[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
.L21:
	mov	rdx, QWORD PTR output_size[rip]
	mov	rax, QWORD PTR output_index[rip]
	add	rax, rdx
	mov	QWORD PTR output_size[rip], rax
	mov	QWORD PTR output_index[rip], 0
.L22:
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	save_output, .-save_output
	.globl	write_byte
	.type	write_byte, @function
write_byte:
.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, 16
	mov	DWORD PTR -4[rbp], edi
	mov	rcx, QWORD PTR output_data[rip]
	mov	rax, QWORD PTR output_index[rip]
	lea	rdx, 1[rax]
	mov	QWORD PTR output_index[rip], rdx
	add	rax, rcx
	mov	edx, DWORD PTR -4[rbp]
	mov	BYTE PTR [rax], dl
	mov	rax, QWORD PTR output_index[rip]
	cmp	rax, 16384
	jne	.L25
	mov	eax, 0
	call	save_output
.L25:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	write_byte, .-write_byte
	.section	.rodata
	.align 8
.LC3:
	.string	"Error: Invalid data in input file %s\n"
	.text
	.globl	write_bytes
	.type	write_bytes, @function
write_bytes:
.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, 32
	mov	DWORD PTR -20[rbp], edi
	mov	DWORD PTR -24[rbp], esi
	mov	eax, DWORD PTR -20[rbp]
	cdqe
	mov	rcx, QWORD PTR output_size[rip]
	mov	rdx, QWORD PTR output_index[rip]
	add	rdx, rcx
	cmp	rax, rdx
	jbe	.L28
	mov	rdx, QWORD PTR input_name[rip]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC3[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
.L31:
	mov	rax, QWORD PTR output_index[rip]
	mov	edx, DWORD PTR -20[rbp]
	sub	eax, edx
	mov	DWORD PTR -4[rbp], eax
	mov	rdx, QWORD PTR output_data[rip]
	cmp	DWORD PTR -4[rbp], 0
	js	.L29
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	jmp	.L30
.L29:
	mov	eax, DWORD PTR -4[rbp]
	add	eax, 16384
	cdqe
.L30:
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	movzx	eax, al
	mov	edi, eax
	call	write_byte
.L28:
	mov	eax, DWORD PTR -24[rbp]
	lea	edx, -1[rax]
	mov	DWORD PTR -24[rbp], edx
	test	eax, eax
	jg	.L31
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	write_bytes, .-write_bytes
	.section	.rodata
.LC4:
	.string	"Error: Insufficient memory\n"
	.align 8
.LC5:
	.string	"Error: Input file %s too long\n"
	.text
	.globl	decompress
	.type	decompress, @function
decompress:
.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	edi, 16384
	call	malloc@PLT
	mov	QWORD PTR input_data[rip], rax
	mov	edi, 16384
	call	malloc@PLT
	mov	QWORD PTR output_data[rip], rax
	mov	rax, QWORD PTR input_data[rip]
	test	rax, rax
	je	.L33
	mov	rax, QWORD PTR output_data[rip]
	test	rax, rax
	jne	.L34
.L33:
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 27
	mov	esi, 1
	lea	rdi, .LC4[rip]
	call	fwrite@PLT
	mov	edi, 1
	call	exit@PLT
.L34:
	mov	QWORD PTR input_size[rip], 0
	mov	QWORD PTR input_index[rip], 0
	mov	QWORD PTR partial_counter[rip], 0
	mov	QWORD PTR output_index[rip], 0
	mov	QWORD PTR output_size[rip], 0
	mov	DWORD PTR bit_mask[rip], 0
	mov	eax, 0
	call	read_byte
	mov	edi, eax
	call	write_byte
.L40:
	mov	eax, 0
	call	read_bit
	test	eax, eax
	jne	.L35
	mov	eax, 0
	call	read_byte
	mov	edi, eax
	call	write_byte
	jmp	.L40
.L35:
	mov	eax, 0
	call	read_elias_gamma
	add	eax, 1
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	jne	.L37
	mov	eax, 0
	call	save_output
	mov	rdx, QWORD PTR input_index[rip]
	mov	rax, QWORD PTR partial_counter[rip]
	cmp	rdx, rax
	je	.L41
	mov	rdx, QWORD PTR input_name[rip]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC5[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
.L37:
	mov	eax, 0
	call	read_offset
	lea	edx, 1[rax]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	mov	edi, edx
	call	write_bytes
	jmp	.L40
.L41:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	decompress, .-decompress
	.section	.rodata
	.align 8
.LC6:
	.string	"DZX7: LZ77/LZSS decompression by Einar Saukas"
.LC7:
	.string	"-f"
.LC8:
	.string	"Error: Invalid parameter %s\n"
.LC9:
	.string	".zx7"
	.align 8
.LC10:
	.string	"Error: Cannot infer output filename\n"
	.align 8
.LC11:
	.string	"Usage: %s [-f] input.zx7 [output]\n  -f      Force overwrite of output file\n"
.LC12:
	.string	"rb"
	.align 8
.LC13:
	.string	"Error: Cannot access input file %s\n"
	.align 8
.LC14:
	.string	"Error: Already existing output file %s\n"
.LC15:
	.string	"wb"
	.align 8
.LC16:
	.string	"Error: Cannot create output file %s\n"
	.align 8
.LC17:
	.string	"File converted from %lu to %lu bytes!\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB14:
	.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
	mov	DWORD PTR -8[rbp], 0
	lea	rdi, .LC6[rip]
	call	puts@PLT
	mov	DWORD PTR -4[rbp], 1
	jmp	.L43
.L47:
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -32[rbp]
	add	rax, rdx
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC7[rip]
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	jne	.L44
	mov	DWORD PTR -8[rbp], 1
	jmp	.L56
.L44:
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -32[rbp]
	add	rax, rdx
	mov	rdx, QWORD PTR [rax]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC8[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
.L56:
	add	DWORD PTR -4[rbp], 1
.L43:
	mov	eax, DWORD PTR -4[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	jge	.L46
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -32[rbp]
	add	rax, rdx
	mov	rax, QWORD PTR [rax]
	movzx	eax, BYTE PTR [rax]
	cmp	al, 45
	je	.L47
.L46:
	mov	eax, DWORD PTR -4[rbp]
	add	eax, 1
	cmp	DWORD PTR -20[rbp], eax
	jne	.L48
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -32[rbp]
	add	rax, rdx
	mov	rax, QWORD PTR [rax]
	mov	QWORD PTR input_name[rip], rax
	mov	rax, QWORD PTR input_name[rip]
	mov	rdi, rax
	call	strlen@PLT
	mov	QWORD PTR input_size[rip], rax
	mov	rax, QWORD PTR input_size[rip]
	cmp	rax, 4
	jbe	.L49
	mov	rdx, QWORD PTR input_name[rip]
	mov	rax, QWORD PTR input_size[rip]
	sub	rax, 4
	add	rax, rdx
	lea	rsi, .LC9[rip]
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	jne	.L49
	mov	rax, QWORD PTR input_size[rip]
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR output_name[rip], rax
	mov	rdx, QWORD PTR input_name[rip]
	mov	rax, QWORD PTR output_name[rip]
	mov	rsi, rdx
	mov	rdi, rax
	call	strcpy@PLT
	mov	rdx, QWORD PTR output_name[rip]
	mov	rax, QWORD PTR input_size[rip]
	sub	rax, 4
	add	rax, rdx
	mov	BYTE PTR [rax], 0
	jmp	.L50
.L49:
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 36
	mov	esi, 1
	lea	rdi, .LC10[rip]
	call	fwrite@PLT
	mov	edi, 1
	call	exit@PLT
.L48:
	mov	eax, DWORD PTR -4[rbp]
	add	eax, 2
	cmp	DWORD PTR -20[rbp], eax
	jne	.L51
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -32[rbp]
	add	rax, rdx
	mov	rax, QWORD PTR [rax]
	mov	QWORD PTR input_name[rip], rax
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	add	rax, 1
	lea	rdx, 0[0+rax*8]
	mov	rax, QWORD PTR -32[rbp]
	add	rax, rdx
	mov	rax, QWORD PTR [rax]
	mov	QWORD PTR output_name[rip], rax
	jmp	.L50
.L51:
	mov	rax, QWORD PTR -32[rbp]
	mov	rdx, QWORD PTR [rax]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC11[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
.L50:
	mov	rax, QWORD PTR input_name[rip]
	lea	rsi, .LC12[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR ifp[rip], rax
	mov	rax, QWORD PTR ifp[rip]
	test	rax, rax
	jne	.L52
	mov	rdx, QWORD PTR input_name[rip]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC13[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
.L52:
	mov	rax, QWORD PTR output_name[rip]
	lea	rsi, .LC12[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR ofp[rip], rax
	mov	rax, QWORD PTR ofp[rip]
	test	rax, rax
	je	.L53
	mov	rax, QWORD PTR ofp[rip]
	mov	rdi, rax
	call	fclose@PLT
	cmp	DWORD PTR -8[rbp], 0
	jne	.L53
	mov	rdx, QWORD PTR output_name[rip]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC14[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
.L53:
	mov	rax, QWORD PTR output_name[rip]
	lea	rsi, .LC15[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR ofp[rip], rax
	mov	rax, QWORD PTR ofp[rip]
	test	rax, rax
	jne	.L54
	mov	rdx, QWORD PTR output_name[rip]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC16[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
.L54:
	mov	eax, 0
	call	decompress
	mov	rax, QWORD PTR ifp[rip]
	mov	rdi, rax
	call	fclose@PLT
	mov	rax, QWORD PTR ofp[rip]
	mov	rdi, rax
	call	fclose@PLT
	mov	rdx, QWORD PTR output_size[rip]
	mov	rax, QWORD PTR input_size[rip]
	mov	rsi, rax
	lea	rdi, .LC17[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.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	"472518.c"
	.text
	.comm	ifp,4,4
	.comm	ofp,4,4
	.comm	input_name,4,4
	.comm	output_name,4,4
	.comm	input_data,4,4
	.comm	output_data,4,4
	.comm	input_index,4,4
	.comm	output_index,4,4
	.comm	input_size,4,4
	.comm	output_size,4,4
	.comm	partial_counter,4,4
	.comm	bit_mask,4,4
	.comm	bit_value,4,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Error: Truncated input file %s\012\000"
	.align	2
.LC1:
	.ascii	"Error: Empty input file %s\012\000"
	.text
	.align	2
	.global	read_byte
	.syntax unified
	.arm
	.fpu softvfp
	.type	read_byte, %function
read_byte:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r3, .L6
	ldr	r2, [r3]
	ldr	r3, .L6+4
	ldr	r3, [r3]
	cmp	r2, r3
	bne	.L2
	ldr	r3, .L6
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L6+8
	ldr	r0, [r3]
	ldr	r3, .L6+12
	ldr	r3, [r3]
	mov	r2, #16384
	mov	r1, #1
	bl	fread
	mov	r3, r0
	ldr	r2, .L6+4
	str	r3, [r2]
	ldr	r3, .L6+16
	ldr	r2, [r3]
	ldr	r3, .L6+4
	ldr	r3, [r3]
	add	r3, r2, r3
	ldr	r2, .L6+16
	str	r3, [r2]
	ldr	r3, .L6+4
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L2
	ldr	r3, .L6+20
	ldr	r0, [r3]
	ldr	r3, .L6+16
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L3
	ldr	r3, .L6+24
	b	.L4
.L3:
	ldr	r3, .L6+28
.L4:
	ldr	r2, .L6+32
	ldr	r2, [r2]
	mov	r1, r3
	bl	fprintf
	mov	r0, #1
	bl	exit
.L2:
	ldr	r3, .L6+8
	ldr	r2, [r3]
	ldr	r3, .L6
	ldr	r3, [r3]
	add	r1, r3, #1
	ldr	r0, .L6
	str	r1, [r0]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r0, r3
	pop	{fp, pc}
.L7:
	.align	2
.L6:
	.word	input_index
	.word	partial_counter
	.word	input_data
	.word	ifp
	.word	input_size
	.word	stderr
	.word	.LC0
	.word	.LC1
	.word	input_name
	.size	read_byte, .-read_byte
	.align	2
	.global	read_bit
	.syntax unified
	.arm
	.fpu softvfp
	.type	read_bit, %function
read_bit:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r3, .L11
	ldr	r3, [r3]
	asr	r3, r3, #1
	ldr	r2, .L11
	str	r3, [r2]
	ldr	r3, .L11
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L9
	ldr	r3, .L11
	mov	r2, #128
	str	r2, [r3]
	bl	read_byte
	mov	r3, r0
	ldr	r2, .L11+4
	str	r3, [r2]
.L9:
	ldr	r3, .L11+4
	ldr	r2, [r3]
	ldr	r3, .L11
	ldr	r3, [r3]
	and	r3, r3, r2
	cmp	r3, #0
	movne	r3, #1
	moveq	r3, #0
	and	r3, r3, #255
	mov	r0, r3
	pop	{fp, pc}
.L12:
	.align	2
.L11:
	.word	bit_mask
	.word	bit_value
	.size	read_bit, .-read_bit
	.align	2
	.global	read_elias_gamma
	.syntax unified
	.arm
	.fpu softvfp
	.type	read_elias_gamma, %function
read_elias_gamma:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #12
	mov	r3, #0
	str	r3, [fp, #-20]
	b	.L14
.L15:
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
.L14:
	bl	read_bit
	mov	r3, r0
	cmp	r3, #0
	beq	.L15
	ldr	r3, [fp, #-20]
	cmp	r3, #15
	ble	.L16
	mvn	r3, #0
	b	.L17
.L16:
	mov	r3, #1
	str	r3, [fp, #-16]
	b	.L18
.L19:
	ldr	r3, [fp, #-16]
	lsl	r4, r3, #1
	bl	read_bit
	mov	r3, r0
	orr	r3, r4, r3
	str	r3, [fp, #-16]
.L18:
	ldr	r3, [fp, #-20]
	sub	r2, r3, #1
	str	r2, [fp, #-20]
	cmp	r3, #0
	bne	.L19
	ldr	r3, [fp, #-16]
.L17:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
	.size	read_elias_gamma, .-read_elias_gamma
	.align	2
	.global	read_offset
	.syntax unified
	.arm
	.fpu softvfp
	.type	read_offset, %function
read_offset:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #12
	bl	read_byte
	str	r0, [fp, #-20]
	ldr	r3, [fp, #-20]
	cmp	r3, #127
	bgt	.L21
	ldr	r3, [fp, #-20]
	b	.L22
.L21:
	bl	read_bit
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-16]
	lsl	r4, r3, #1
	bl	read_bit
	mov	r3, r0
	orr	r3, r4, r3
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-16]
	lsl	r4, r3, #1
	bl	read_bit
	mov	r3, r0
	orr	r3, r4, r3
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-16]
	lsl	r4, r3, #1
	bl	read_bit
	mov	r3, r0
	orr	r3, r4, r3
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-20]
	and	r2, r3, #127
	ldr	r3, [fp, #-16]
	lsl	r3, r3, #7
	orr	r3, r2, r3
	add	r3, r3, #128
.L22:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
	.size	read_offset, .-read_offset
	.section	.rodata
	.align	2
.LC2:
	.ascii	"Error: Cannot write output file %s\012\000"
	.text
	.align	2
	.global	save_output
	.syntax unified
	.arm
	.fpu softvfp
	.type	save_output, %function
save_output:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r3, .L27
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L26
	ldr	r3, .L27+4
	ldr	r0, [r3]
	ldr	r3, .L27
	ldr	r2, [r3]
	ldr	r3, .L27+8
	ldr	r3, [r3]
	mov	r1, #1
	bl	fwrite
	mov	r2, r0
	ldr	r3, .L27
	ldr	r3, [r3]
	cmp	r2, r3
	beq	.L25
	ldr	r3, .L27+12
	ldr	r3, [r3]
	ldr	r2, .L27+16
	ldr	r2, [r2]
	ldr	r1, .L27+20
	mov	r0, r3
	bl	fprintf
	mov	r0, #1
	bl	exit
.L25:
	ldr	r3, .L27+24
	ldr	r2, [r3]
	ldr	r3, .L27
	ldr	r3, [r3]
	add	r3, r2, r3
	ldr	r2, .L27+24
	str	r3, [r2]
	ldr	r3, .L27
	mov	r2, #0
	str	r2, [r3]
.L26:
	nop
	pop	{fp, pc}
.L28:
	.align	2
.L27:
	.word	output_index
	.word	output_data
	.word	ofp
	.word	stderr
	.word	output_name
	.word	.LC2
	.word	output_size
	.size	save_output, .-save_output
	.align	2
	.global	write_byte
	.syntax unified
	.arm
	.fpu softvfp
	.type	write_byte, %function
write_byte:
	@ 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, .L32
	ldr	r2, [r3]
	ldr	r3, .L32+4
	ldr	r3, [r3]
	add	r1, r3, #1
	ldr	r0, .L32+4
	str	r1, [r0]
	add	r3, r2, r3
	ldr	r2, [fp, #-8]
	and	r2, r2, #255
	strb	r2, [r3]
	ldr	r3, .L32+4
	ldr	r3, [r3]
	cmp	r3, #16384
	bne	.L31
	bl	save_output
.L31:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L33:
	.align	2
.L32:
	.word	output_data
	.word	output_index
	.size	write_byte, .-write_byte
	.section	.rodata
	.align	2
.LC3:
	.ascii	"Error: Invalid data in input file %s\012\000"
	.text
	.align	2
	.global	write_bytes
	.syntax unified
	.arm
	.fpu softvfp
	.type	write_bytes, %function
write_bytes:
	@ 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, .L40
	ldr	r2, [r3]
	ldr	r3, .L40+4
	ldr	r3, [r3]
	add	r2, r2, r3
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	bcs	.L36
	ldr	r3, .L40+8
	ldr	r3, [r3]
	ldr	r2, .L40+12
	ldr	r2, [r2]
	ldr	r1, .L40+16
	mov	r0, r3
	bl	fprintf
	mov	r0, #1
	bl	exit
.L39:
	ldr	r3, .L40+4
	ldr	r2, [r3]
	ldr	r3, [fp, #-16]
	sub	r3, r2, r3
	str	r3, [fp, #-8]
	ldr	r3, .L40+20
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bge	.L37
	ldr	r3, [fp, #-8]
	add	r3, r3, #16384
	b	.L38
.L37:
	ldr	r3, [fp, #-8]
.L38:
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r0, r3
	bl	write_byte
.L36:
	ldr	r3, [fp, #-20]
	sub	r2, r3, #1
	str	r2, [fp, #-20]
	cmp	r3, #0
	bgt	.L39
	nop
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L41:
	.align	2
.L40:
	.word	output_size
	.word	output_index
	.word	stderr
	.word	input_name
	.word	.LC3
	.word	output_data
	.size	write_bytes, .-write_bytes
	.section	.rodata
	.align	2
.LC4:
	.ascii	"Error: Insufficient memory\012\000"
	.align	2
.LC5:
	.ascii	"Error: Input file %s too long\012\000"
	.text
	.align	2
	.global	decompress
	.syntax unified
	.arm
	.fpu softvfp
	.type	decompress, %function
decompress:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	mov	r0, #16384
	bl	malloc
	mov	r3, r0
	mov	r2, r3
	ldr	r3, .L52
	str	r2, [r3]
	mov	r0, #16384
	bl	malloc
	mov	r3, r0
	mov	r2, r3
	ldr	r3, .L52+4
	str	r2, [r3]
	ldr	r3, .L52
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L43
	ldr	r3, .L52+4
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L44
.L43:
	ldr	r3, .L52+8
	ldr	r3, [r3]
	mov	r2, #27
	mov	r1, #1
	ldr	r0, .L52+12
	bl	fwrite
	mov	r0, #1
	bl	exit
.L44:
	ldr	r3, .L52+16
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L52+20
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L52+24
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L52+28
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L52+32
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L52+36
	mov	r2, #0
	str	r2, [r3]
	bl	read_byte
	mov	r3, r0
	mov	r0, r3
	bl	write_byte
.L50:
	bl	read_bit
	mov	r3, r0
	cmp	r3, #0
	bne	.L45
	bl	read_byte
	mov	r3, r0
	mov	r0, r3
	bl	write_byte
	b	.L50
.L45:
	bl	read_elias_gamma
	mov	r3, r0
	add	r3, r3, #1
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L47
	bl	save_output
	ldr	r3, .L52+20
	ldr	r2, [r3]
	ldr	r3, .L52+24
	ldr	r3, [r3]
	cmp	r2, r3
	beq	.L51
	ldr	r3, .L52+8
	ldr	r3, [r3]
	ldr	r2, .L52+40
	ldr	r2, [r2]
	ldr	r1, .L52+44
	mov	r0, r3
	bl	fprintf
	mov	r0, #1
	bl	exit
.L47:
	bl	read_offset
	mov	r3, r0
	add	r3, r3, #1
	ldr	r1, [fp, #-8]
	mov	r0, r3
	bl	write_bytes
	b	.L50
.L51:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L53:
	.align	2
.L52:
	.word	input_data
	.word	output_data
	.word	stderr
	.word	.LC4
	.word	input_size
	.word	input_index
	.word	partial_counter
	.word	output_index
	.word	output_size
	.word	bit_mask
	.word	input_name
	.word	.LC5
	.size	decompress, .-decompress
	.section	.rodata
	.align	2
.LC6:
	.ascii	"DZX7: LZ77/LZSS decompression by Einar Saukas\000"
	.align	2
.LC7:
	.ascii	"-f\000"
	.align	2
.LC8:
	.ascii	"Error: Invalid parameter %s\012\000"
	.align	2
.LC9:
	.ascii	".zx7\000"
	.align	2
.LC10:
	.ascii	"Error: Cannot infer output filename\012\000"
	.align	2
.LC11:
	.ascii	"Usage: %s [-f] input.zx7 [output]\012  -f      Forc"
	.ascii	"e overwrite of output file\012\000"
	.align	2
.LC12:
	.ascii	"rb\000"
	.align	2
.LC13:
	.ascii	"Error: Cannot access input file %s\012\000"
	.align	2
.LC14:
	.ascii	"Error: Already existing output file %s\012\000"
	.align	2
.LC15:
	.ascii	"wb\000"
	.align	2
.LC16:
	.ascii	"Error: Cannot create output file %s\012\000"
	.align	2
.LC17:
	.ascii	"File converted from %lu to %lu bytes!\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]
	mov	r3, #0
	str	r3, [fp, #-12]
	ldr	r0, .L69
	bl	puts
	mov	r3, #1
	str	r3, [fp, #-8]
	b	.L55
.L59:
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-20]
	add	r3, r2, r3
	ldr	r3, [r3]
	ldr	r1, .L69+4
	mov	r0, r3
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L56
	mov	r3, #1
	str	r3, [fp, #-12]
	b	.L68
.L56:
	ldr	r3, .L69+8
	ldr	r0, [r3]
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-20]
	add	r3, r2, r3
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L69+12
	bl	fprintf
	mov	r0, #1
	bl	exit
.L68:
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L55:
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-16]
	cmp	r2, r3
	bge	.L58
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-20]
	add	r3, r2, r3
	ldr	r3, [r3]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #45
	beq	.L59
.L58:
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	ldr	r2, [fp, #-16]
	cmp	r2, r3
	bne	.L60
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-20]
	add	r3, r2, r3
	ldr	r3, [r3]
	ldr	r2, .L69+16
	str	r3, [r2]
	ldr	r3, .L69+16
	ldr	r3, [r3]
	mov	r0, r3
	bl	strlen
	mov	r3, r0
	ldr	r2, .L69+20
	str	r3, [r2]
	ldr	r3, .L69+20
	ldr	r3, [r3]
	cmp	r3, #4
	bls	.L61
	ldr	r3, .L69+16
	ldr	r2, [r3]
	ldr	r3, .L69+20
	ldr	r3, [r3]
	sub	r3, r3, #4
	add	r3, r2, r3
	ldr	r1, .L69+24
	mov	r0, r3
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L61
	ldr	r3, .L69+20
	ldr	r3, [r3]
	mov	r0, r3
	bl	malloc
	mov	r3, r0
	mov	r2, r3
	ldr	r3, .L69+28
	str	r2, [r3]
	ldr	r3, .L69+28
	ldr	r3, [r3]
	ldr	r2, .L69+16
	ldr	r2, [r2]
	mov	r1, r2
	mov	r0, r3
	bl	strcpy
	ldr	r3, .L69+28
	ldr	r2, [r3]
	ldr	r3, .L69+20
	ldr	r3, [r3]
	sub	r3, r3, #4
	add	r3, r2, r3
	mov	r2, #0
	strb	r2, [r3]
	b	.L62
.L61:
	ldr	r3, .L69+8
	ldr	r3, [r3]
	mov	r2, #36
	mov	r1, #1
	ldr	r0, .L69+32
	bl	fwrite
	mov	r0, #1
	bl	exit
.L60:
	ldr	r3, [fp, #-8]
	add	r3, r3, #2
	ldr	r2, [fp, #-16]
	cmp	r2, r3
	bne	.L63
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-20]
	add	r3, r2, r3
	ldr	r3, [r3]
	ldr	r2, .L69+16
	str	r3, [r2]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	lsl	r3, r3, #2
	ldr	r2, [fp, #-20]
	add	r3, r2, r3
	ldr	r3, [r3]
	ldr	r2, .L69+28
	str	r3, [r2]
	b	.L62
.L63:
	ldr	r3, .L69+8
	ldr	r0, [r3]
	ldr	r3, [fp, #-20]
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L69+36
	bl	fprintf
	mov	r0, #1
	bl	exit
.L62:
	ldr	r3, .L69+16
	ldr	r3, [r3]
	ldr	r1, .L69+40
	mov	r0, r3
	bl	fopen
	mov	r3, r0
	ldr	r2, .L69+44
	str	r3, [r2]
	ldr	r3, .L69+44
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L64
	ldr	r3, .L69+8
	ldr	r3, [r3]
	ldr	r2, .L69+16
	ldr	r2, [r2]
	ldr	r1, .L69+48
	mov	r0, r3
	bl	fprintf
	mov	r0, #1
	bl	exit
.L64:
	ldr	r3, .L69+28
	ldr	r3, [r3]
	ldr	r1, .L69+40
	mov	r0, r3
	bl	fopen
	mov	r3, r0
	ldr	r2, .L69+52
	str	r3, [r2]
	ldr	r3, .L69+52
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L65
	ldr	r3, .L69+52
	ldr	r3, [r3]
	mov	r0, r3
	bl	fclose
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bne	.L65
	ldr	r3, .L69+8
	ldr	r3, [r3]
	ldr	r2, .L69+28
	ldr	r2, [r2]
	ldr	r1, .L69+56
	mov	r0, r3
	bl	fprintf
	mov	r0, #1
	bl	exit
.L65:
	ldr	r3, .L69+28
	ldr	r3, [r3]
	ldr	r1, .L69+60
	mov	r0, r3
	bl	fopen
	mov	r3, r0
	ldr	r2, .L69+52
	str	r3, [r2]
	ldr	r3, .L69+52
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L66
	ldr	r3, .L69+8
	ldr	r3, [r3]
	ldr	r2, .L69+28
	ldr	r2, [r2]
	ldr	r1, .L69+64
	mov	r0, r3
	bl	fprintf
	mov	r0, #1
	bl	exit
.L66:
	bl	decompress
	ldr	r3, .L69+44
	ldr	r3, [r3]
	mov	r0, r3
	bl	fclose
	ldr	r3, .L69+52
	ldr	r3, [r3]
	mov	r0, r3
	bl	fclose
	ldr	r3, .L69+20
	ldr	r3, [r3]
	ldr	r2, .L69+68
	ldr	r2, [r2]
	mov	r1, r3
	ldr	r0, .L69+72
	bl	printf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L70:
	.align	2
.L69:
	.word	.LC6
	.word	.LC7
	.word	stderr
	.word	.LC8
	.word	input_name
	.word	input_size
	.word	.LC9
	.word	output_name
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.word	ifp
	.word	.LC13
	.word	ofp
	.word	.LC14
	.word	.LC15
	.word	.LC16
	.word	output_size
	.word	.LC17
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
