// File: /workspace/github_c_makefile_star2_O0/ender672[P]liboil/imgscale.c
// Function: main
int main(int argc, char *argv[])
{
	int width, height;
	char *end;
	FILE *io_in, *io_out;

	io_in = stdin;
	io_out = stdout;

	if (argc < 3) {
		fprintf(stderr, "Usage: %s WIDTH HEIGHT [file] [file]\n", argv[0]);
		return 1;
	}

	if (argc > 3) {
		io_in = fopen(argv[3], "r");
		if (!io_in) {
			fprintf(stderr, "Unable to open source file.\n");
			return 1;
		}
	}

	if (argc > 4) {
		io_out = fopen(argv[4], "w");
		if (!io_out) {
			fprintf(stderr, "Unable to open destination file.\n");
			return 1;
		}
	}

	width = strtoul(argv[1], &end, 10);
	if (*end) {
		fprintf(stderr, "Error: Invalid width.\n");
		return 1;
	}

	height = strtoul(argv[2], &end, 10);
	if (*end) {
		fprintf(stderr, "Error: Invalid height.\n");
		return 1;
	}

	if (looks_like_png(io_in)) {
		png(io_in, io_out, width, height);
	} else {
		jpeg(io_in, io_out, width, height);
	}

	fclose(io_in);
	fclose(io_out);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x455b(%rip), %rax      # 0x9fd8
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq 0x456d(%rip), %rax      # 0x9ff8
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpl $0x3, -0x8(%rbp)
jge 0x5ac3
movq 0x4549(%rip), %rax      # 0x9fe8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x1640(%rip), %rsi      # 0x70f0
movb $0x0, %al
callq 0x2360
movl $0x1, -0x4(%rbp)
jmp 0x5c31
cmpl $0x3, -0x8(%rbp)
jle 0x5b0e
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x163e(%rip), %rsi      # 0x7116
callq 0x20e0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x5b0c
movq 0x44f9(%rip), %rax      # 0x9fe8
movq (%rax), %rdi
leaq 0x161f(%rip), %rsi      # 0x7118
movb $0x0, %al
callq 0x2360
movl $0x1, -0x4(%rbp)
jmp 0x5c31
jmp 0x5b0e
cmpl $0x4, -0x8(%rbp)
jle 0x5b59
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x1612(%rip), %rsi      # 0x7135
callq 0x20e0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x5b57
movq 0x44ae(%rip), %rax      # 0x9fe8
movq (%rax), %rdi
leaq 0x15f3(%rip), %rsi      # 0x7137
movb $0x0, %al
callq 0x2360
movl $0x1, -0x4(%rbp)
jmp 0x5c31
jmp 0x5b59
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x20(%rbp), %rsi
movl $0xa, %edx
callq 0x2390
movl %eax, -0x14(%rbp)
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
je 0x5b9f
movq 0x4466(%rip), %rax      # 0x9fe8
movq (%rax), %rdi
leaq 0x15cd(%rip), %rsi      # 0x7159
movb $0x0, %al
callq 0x2360
movl $0x1, -0x4(%rbp)
jmp 0x5c31
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq -0x20(%rbp), %rsi
movl $0xa, %edx
callq 0x2390
movl %eax, -0x18(%rbp)
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
je 0x5be2
movq 0x4420(%rip), %rax      # 0x9fe8
movq (%rax), %rdi
leaq 0x159e(%rip), %rsi      # 0x7170
movb $0x0, %al
callq 0x2360
movl $0x1, -0x4(%rbp)
jmp 0x5c31
movq -0x28(%rbp), %rdi
callq 0x5a20
cmpl $0x0, %eax
je 0x5c05
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0x5c40
jmp 0x5c18
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0x5ef0
movq -0x28(%rbp), %rdi
callq 0x22e0
movq -0x30(%rbp), %rdi
callq 0x22e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)