// File: /workspace/github_c_makefile_star2_O0/lmcilroy[P]lzm/lzm.c
// Function: process_file
static unsigned int
process_file(struct compress_args * const args)
{
	struct stat st;
	int fd_in = -1;
	int fd_out = -1;
	unsigned int remove = false;
	int err;
	int ret;

	if (args->st->st_size == 0) {
		ret = EINVAL;
		fprintf(stderr, "File %s: zero size, skipping\n",
		    args->filename);
		goto out;
	}

	fd_in = open(args->filename, O_RDONLY);
	if (fd_in < 0) {
		ret = errno;
		fprintf(stderr, "File %s: failed to open file: %s\n",
		    args->filename, strerror(ret));
		goto out;
	}

	posix_fadvise(fd_in, 0, 0, POSIX_FADV_SEQUENTIAL);

	if (args->benchmark == true) {
		ret = benchmark(fd_in, args);
		goto out;
	}

	if (args->test == false) {
		if (args->console == true) {
			fd_out = STDOUT_FILENO;
			if (isatty(fd_out)) {
				ret = EIO;
				fprintf(stderr, "Will not write to terminal\n");
				goto out;
			}

			strcpy(args->filename_out, "(stdout)");
		} else {
			ret = output_filename(args);
			if (ret != 0)
				goto out;

			ret = stat(args->filename_out, &st);
			if (ret == 0) {
				if (args->clobber == true) {
					ret = unlink(args->filename_out);
					if (ret < 0) {
						ret = errno;
						fprintf(stderr, "File %s: cannot remove: %s\n",
						    args->filename_out, strerror(ret));
						goto out;
					}
				} else {
					ret = EEXIST;
					fprintf(stderr, "File %s: not overwriting existing file\n",
					    args->filename_out);
					goto out;
				}
			}

			fd_out = open(args->filename_out,
			    O_WRONLY|O_CREAT|O_EXCL, 0600);
			if (fd_out < 0) {
				ret = errno;
				fprintf(stderr, "File %s: failed to open file: %s\n",
				    args->filename_out, strerror(ret));
				goto out;
			}

			remove = true;
		}
	}

	ret = process_data(fd_in, fd_out, args);
	if (ret != 0) {
		if (remove == true) {
			err = unlink(args->filename_out);
			if (err < 0) {
				err = errno;
				fprintf(stderr, "File %s: cannot remove: %s\n",
				    args->filename, strerror(err));
				goto out;
			}
		}
		goto out;
	}

	if (args->remove == true && args->test == false) {
		ret = stat(args->filename, &st);
		if (ret < 0) {
			ret = errno;
			fprintf(stderr, "File %s: cannot stat: %s\n",
			    args->filename, strerror(ret));
			goto out;
		}

		/* Check source file hasn't changed */
		if (st.st_dev == args->st->st_dev &&
		    st.st_ino == args->st->st_ino) {
			ret = unlink(args->filename);
			if (ret < 0) {
				ret = errno;
				fprintf(stderr, "File %s: cannot remove: %s\n",
				    args->filename, strerror(ret));
				goto out;
			}
		}
	}

 out:

	if (fd_in != -1 && fd_in != STDIN_FILENO)
		close(fd_in);
	if (fd_out != -1 && fd_out != STDOUT_FILENO)
		close(fd_out);

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movl $0xffffffff, -0x9c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0xa0(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0xa4(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x30(%rax)
jne 0x1b3a
movl $0x16, -0xac(%rbp)
movq 0x84dc(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x5a86(%rip), %rsi      # 0x75b4
movb $0x0, %al
callq 0x1190
jmp 0x1fef
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x11d0
movl %eax, -0x9c(%rbp)
cmpl $0x0, -0x9c(%rbp)
jge 0x1bb6
callq 0x1040
movl (%rax), %eax
movl %eax, -0xac(%rbp)
movq 0x848a(%rip), %rax      # 0x9ff8
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xb8(%rbp)
movl -0xac(%rbp), %edi
callq 0x1250
movq -0xc0(%rbp), %rdi
movq -0xb8(%rbp), %rdx
movq %rax, %rcx
leaq 0x5a28(%rip), %rsi      # 0x75d2
movb $0x0, %al
callq 0x1190
jmp 0x1fef
movl -0x9c(%rbp), %edi
xorl %eax, %eax
movl %eax, %edx
movl $0x2, %ecx
movq %rdx, %rsi
callq 0x1140
movq -0x8(%rbp), %rax
cmpl $0x1, 0x1030(%rax)
jne 0x1bf4
movl -0x9c(%rbp), %edi
movq -0x8(%rbp), %rsi
callq 0x2f70
movl %eax, -0xac(%rbp)
jmp 0x1fef
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1038(%rax)
jne 0x1df8
movq -0x8(%rbp), %rax
cmpl $0x1, 0x1020(%rax)
jne 0x1c6c
movl $0x1, -0xa0(%rbp)
movl -0xa0(%rbp), %edi
callq 0x1080
cmpl $0x0, %eax
je 0x1c53
movl $0x5, -0xac(%rbp)
movq 0x83bb(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
leaq 0x5748(%rip), %rsi      # 0x738f
movb $0x0, %al
callq 0x1190
jmp 0x1fef
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
leaq 0x5749(%rip), %rsi      # 0x73ab
callq 0x1070
jmp 0x1df6
movq -0x8(%rbp), %rdi
callq 0x33f0
movl %eax, -0xac(%rbp)
cmpl $0x0, -0xac(%rbp)
je 0x1c89
jmp 0x1fef
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
leaq -0x98(%rbp), %rsi
callq 0x11a0
movl %eax, -0xac(%rbp)
cmpl $0x0, -0xac(%rbp)
jne 0x1d68
movq -0x8(%rbp), %rax
cmpl $0x1, 0x1024(%rax)
jne 0x1d37
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
callq 0x1050
movl %eax, -0xac(%rbp)
cmpl $0x0, -0xac(%rbp)
jge 0x1d35
callq 0x1040
movl (%rax), %eax
movl %eax, -0xac(%rbp)
movq 0x830b(%rip), %rax      # 0x9ff8
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xc8(%rbp)
movl -0xac(%rbp), %edi
callq 0x1250
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rdx
movq %rax, %rcx
leaq 0x58cb(%rip), %rsi      # 0x75f4
movb $0x0, %al
callq 0x1190
jmp 0x1fef
jmp 0x1d66
movl $0x11, -0xac(%rbp)
movq 0x82b0(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movq -0x8(%rbp), %rdx
addq $0x10, %rdx
leaq 0x58b6(%rip), %rsi      # 0x7610
movb $0x0, %al
callq 0x1190
jmp 0x1fef
jmp 0x1d68
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
movl $0xc1, %esi
movl $0x180, %edx            # imm = 0x180
movb $0x0, %al
callq 0x11d0
movl %eax, -0xa0(%rbp)
cmpl $0x0, -0xa0(%rbp)
jge 0x1dec
callq 0x1040
movl (%rax), %eax
movl %eax, -0xac(%rbp)
movq 0x8254(%rip), %rax      # 0x9ff8
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xd8(%rbp)
movl -0xac(%rbp), %edi
callq 0x1250
movq -0xe0(%rbp), %rdi
movq -0xd8(%rbp), %rdx
movq %rax, %rcx
leaq 0x57f2(%rip), %rsi      # 0x75d2
movb $0x0, %al
callq 0x1190
jmp 0x1fef
movl $0x1, -0xa4(%rbp)
jmp 0x1df8
movl -0x9c(%rbp), %edi
movl -0xa0(%rbp), %esi
movq -0x8(%rbp), %rdx
callq 0x2040
movl %eax, -0xac(%rbp)
cmpl $0x0, -0xac(%rbp)
je 0x1ea8
cmpl $0x1, -0xa4(%rbp)
jne 0x1ea3
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
callq 0x1050
movl %eax, -0xa8(%rbp)
cmpl $0x0, -0xa8(%rbp)
jge 0x1ea1
callq 0x1040
movl (%rax), %eax
movl %eax, -0xa8(%rbp)
movq 0x819f(%rip), %rax      # 0x9ff8
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xe8(%rbp)
movl -0xa8(%rbp), %edi
callq 0x1250
movq -0xf0(%rbp), %rdi
movq -0xe8(%rbp), %rdx
movq %rax, %rcx
leaq 0x575f(%rip), %rsi      # 0x75f4
movb $0x0, %al
callq 0x1190
jmp 0x1fef
jmp 0x1ea3
jmp 0x1fef
movq -0x8(%rbp), %rax
cmpl $0x1, 0x102c(%rax)
jne 0x1fed
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1038(%rax)
jne 0x1fed
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x98(%rbp), %rsi
callq 0x11a0
movl %eax, -0xac(%rbp)
cmpl $0x0, -0xac(%rbp)
jge 0x1f49
callq 0x1040
movl (%rax), %eax
movl %eax, -0xac(%rbp)
movq 0x80f7(%rip), %rax      # 0x9ff8
movq (%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xf8(%rbp)
movl -0xac(%rbp), %edi
callq 0x1250
movq -0x100(%rbp), %rdi
movq -0xf8(%rbp), %rdx
movq %rax, %rcx
leaq 0x53dd(%rip), %rsi      # 0x731a
movb $0x0, %al
callq 0x1190
jmp 0x1fef
movq -0x98(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
cmpq (%rcx), %rax
jne 0x1feb
movq -0x90(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
cmpq 0x8(%rcx), %rax
jne 0x1feb
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1050
movl %eax, -0xac(%rbp)
cmpl $0x0, -0xac(%rbp)
jge 0x1fe9
callq 0x1040
movl (%rax), %eax
movl %eax, -0xac(%rbp)
movq 0x8054(%rip), %rax      # 0x9ff8
movq (%rax), %rax
movq %rax, -0x110(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x108(%rbp)
movl -0xac(%rbp), %edi
callq 0x1250
movq -0x110(%rbp), %rdi
movq -0x108(%rbp), %rdx
movq %rax, %rcx
leaq 0x5614(%rip), %rsi      # 0x75f4
movb $0x0, %al
callq 0x1190
jmp 0x1fef
jmp 0x1feb
jmp 0x1fed
jmp 0x1fef
cmpl $-0x1, -0x9c(%rbp)
je 0x200c
cmpl $0x0, -0x9c(%rbp)
je 0x200c
movl -0x9c(%rbp), %edi
callq 0x1120
cmpl $-0x1, -0xa0(%rbp)
je 0x2029
cmpl $0x1, -0xa0(%rbp)
je 0x2029
movl -0xa0(%rbp), %edi
callq 0x1120
movl -0xac(%rbp), %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopl (%rax,%rax)