// File: /workspace/github_c_makefile_star2_O3/halcy[P]quasi_crystals_bot/Engine/Main.c
// Function: main
int main(int argc,const char **argv)
{
	Aspect=1.0/1.0;
	Duration=1.0;
	Size=256;
	FPS=19;
	Oversampling=1;

	const char *start=strrchr(argv[0],'/');
	if(!start) start=strrchr(argv[0],'\\');
	if(!start) start=argv[0]-1;
	start++;

	const char *end=strrchr(start,'.');
	if(!end) end=start+strlen(start);

	size_t length=end-start;
	char filename[length+5];
	memcpy(filename,start,length);
	strcpy(filename+length,".gif");

	Filename=filename;


	int firstArg = 1;

	float paramsIn[16];
    for(int i = 0; i < 16; i++) {
		paramsIn[i] = atof(argv[firstArg + i]);
	}
	
	int paletteIn[768];
	for(int i = 0; i < 768; i++) {
		paletteIn[i] = atoi(argv[firstArg + i + 16]);
	}

	Configure(paramsIn, paletteIn);
    
	ParseArguments(argc - (256 * 3 + 16), argv + (256 * 3 + 16));
    
	int width,height;
	if(Aspect>1)
	{
		width=Size;
		height=(Size/Aspect+0.5);
	}
	else
	{
		width=(Size*Aspect+0.5);
		height=Size;
	}


	RenderGIFAnimation(width,height);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq -0xc48(%rsp), %rsp
movl $0x3f800000, %eax       # imm = 0x3F800000
movl $0x100, 0x109dc(%rip)   # imm = 0x100
movl $0x41980000, 0x109d6(%rip) # imm = 0x41980000
movl $0x1, 0x109d0(%rip)     # 0x13598
movq %rsi, %rbx
movl %edi, %r14d
movl %eax, 0x109b4(%rip)     # 0x13588
movl %eax, 0x109b2(%rip)     # 0x1358c
movq (%rsi), %r12
movl $0x2f, %esi
movq %r12, %rdi
callq 0x10c0
movq %rax, %r15
testq %rax, %rax
jne 0x2c0c
movq %r12, %rdi
movl $0x5c, %esi
callq 0x10c0
decq %r12
testq %rax, %rax
cmovneq %rax, %r12
movq %r12, %r15
incq %r15
movl $0x2e, %esi
movq %r15, %rdi
callq 0x10c0
movq %rax, %r12
testq %rax, %rax
jne 0x2c32
movq %r15, %rdi
callq 0x10a0
movq %rax, %r12
addq %r15, %r12
subq %r15, %r12
movq %rsp, %r13
leaq 0x14(%r12), %rax
andq $-0x10, %rax
subq %rax, %r13
movq %r13, %rsp
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1140
movq $-0x40, %r15
movl $0x6669672e, (%r12,%r13) # imm = 0x6669672E
movb $0x0, 0x4(%r12,%r13)
movq %r13, 0x1092f(%rip)     # 0x135a0
movq 0x88(%rbx,%r15,2), %rdi
callq 0x1070
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x30(%rbp,%r15)
addq $0x4, %r15
jne 0x2c71
movq $-0xc00, %r15           # imm = 0xF400
movq 0x1888(%rbx,%r15,2), %rdi
callq 0x11c0
movl %eax, -0x70(%rbp,%r15)
addq $0x4, %r15
jne 0x2c96
leaq -0x70(%rbp), %rdi
leaq -0xc70(%rbp), %rsi
callq 0x178c
cmpl $0x312, %r14d           # imm = 0x312
movl $0x1, -0x2c(%rbp)
jl 0x2d92
addl $0xfffffcf0, %r14d      # imm = 0xFFFFFCF0
addq $0x1880, %rbx           # imm = 0x1880
movl $0x1, %eax
xorl %r12d, %r12d
leaq -0x2c(%rbp), %r15
movslq %eax, %rcx
movq (%rbx,%rcx,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x2d25
movzbl 0x1(%rdi), %ecx
cmpl $0x66, %ecx
je 0x2d48
cmpl $0x6f, %ecx
je 0x2d32
cmpl $0x73, %ecx
jne 0x2db3
movl %r14d, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2de4
movl %eax, 0x1086d(%rip)     # 0x13590
jmp 0x2d75
testq %r12, %r12
movq %rdi, %r12
je 0x2d75
jmp 0x2db3
movl %r14d, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2de4
movl %eax, 0x10852(%rip)     # 0x13598
jmp 0x2d75
cmpb $0x0, 0x2(%rdi)
je 0x2d54
addq $0x2, %rdi
jmp 0x2d64
incl %eax
cmpl %r14d, %eax
movl %eax, -0x2c(%rbp)
jge 0x2db3
cltq
movq (%rbx,%rax,8), %rdi
callq 0x1070
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1081f(%rip)    # 0x13594
movl -0x2c(%rbp), %eax
incl %eax
cmpl %r14d, %eax
movl %eax, -0x2c(%rbp)
jl 0x2cec
testq %r12, %r12
je 0x2d92
movq %r12, 0x1080e(%rip)     # 0x135a0
leaq -0xc70(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x1225
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rdi
callq 0x2e19