// File: /workspace/github_c_makefile_star2_O0/w4kfu[P]HommI/Icn/main.c
// Function: main
int main(int argc, char *argv[])
{
	struct icn *icn = NULL;
	unsigned int width;
	unsigned int height;
	unsigned char *dataimg = NULL;
	unsigned char *pal = NULL;
	char outputname[4096];
	unsigned int i;

	if (argc != 3)
	{
		fprintf(stderr, "%s <*.icn> <*.pal>\n", argv[0]);
		return EXIT_FAILURE;
	}
	if ((icn = openicn(argv[1])))
	{
		if (!(pal = open_palette(argv[2])))
			return EXIT_FAILURE;
		printicninfo(icn);
		width = icngetmaxwidth(icn);
		height = icngetmaxheight(icn);
		printf("Width = %X (%d)\n", width, width);
		printf("Height = %X (%d)\n", height, height);
		for (i = 0; i < icn->numentry; i++)
		{
			sprintf(outputname, "./extract/%s_%d.png", "TESTO", i);
			if (strstr(argv[1], "font.icn"))
				dataimg = icnmakeimg(icn, i, width, height, pal, 0);
			else
				dataimg = icnmakeimg(icn, i, width, height, pal, 1);
			if (dataimg)
			{
				writeImage(outputname, width, height, dataimg, "LOL");
				free(dataimg);
			}
		}
		closeicn(icn);
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1040, %rsp           # imm = 0x1040
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
cmpl $0x3, -0x8(%rbp)
je 0x1672
movq 0x39aa(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x1a19(%rip), %rsi      # 0x3078
movb $0x0, %al
callq 0x10e0
movl $0x1, -0x4(%rbp)
jmp 0x17fe
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1810
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x17f7
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x1ff0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x16b0
movl $0x1, -0x4(%rbp)
jmp 0x17fe
movq -0x18(%rbp), %rdi
callq 0x1b20
movq -0x18(%rbp), %rdi
callq 0x1bf0
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1c70
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %esi
movl -0x1c(%rbp), %edx
leaq 0x19ae(%rip), %rdi      # 0x308c
movb $0x0, %al
callq 0x1090
movl -0x20(%rbp), %esi
movl -0x20(%rbp), %edx
leaq 0x19ab(%rip), %rdi      # 0x309d
movb $0x0, %al
callq 0x1090
movl $0x0, -0x1034(%rbp)
movl -0x1034(%rbp), %eax
movq -0x18(%rbp), %rcx
movzwl (%rcx), %ecx
cmpl %ecx, %eax
jae 0x17ee
leaq -0x1030(%rbp), %rdi
movl -0x1034(%rbp), %ecx
leaq 0x1983(%rip), %rsi      # 0x30af
leaq 0x1990(%rip), %rdx      # 0x30c3
movb $0x0, %al
callq 0x1190
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x1980(%rip), %rsi      # 0x30c9
callq 0x11b0
cmpq $0x0, %rax
je 0x177f
movq -0x18(%rbp), %rdi
movl -0x1034(%rbp), %esi
movl -0x1c(%rbp), %eax
movw %ax, %cx
movl -0x20(%rbp), %eax
movq -0x30(%rbp), %r8
xorl %r9d, %r9d
movzwl %cx, %edx
movzwl %ax, %ecx
callq 0x1cf0
movq %rax, -0x28(%rbp)
jmp 0x17ab
movq -0x18(%rbp), %rdi
movl -0x1034(%rbp), %esi
movl -0x1c(%rbp), %eax
movw %ax, %cx
movl -0x20(%rbp), %eax
movq -0x30(%rbp), %r8
movl $0x1, %r9d
movzwl %cx, %edx
movzwl %ax, %ecx
callq 0x1cf0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x17d8
leaq -0x1030(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
movq -0x28(%rbp), %rcx
leaq 0x1908(%rip), %r8       # 0x30d2
callq 0x1300
movq -0x28(%rbp), %rdi
callq 0x1040
jmp 0x17da
movl -0x1034(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1034(%rbp)
jmp 0x1703
movq -0x18(%rbp), %rdi
callq 0x1ac0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1040, %rsp           # imm = 0x1040
popq %rbp
retq
nopw (%rax,%rax)