// File: intheswim[P]FractalTubes/main.cpp
// Function: parse_arguments(int, char**, argvOptions*)
static void parse_arguments (int argc, char *argv[], 
            struct argvOptions * params) 
{
	int idx;

    int delay_idx = -1;
    int detail_idx = -1;
	int palette_idx = -1;
	int interval_idx = -1;
    int light_idx = -1;
    int transp_idx = -1;
    int speed_idx = -1;
    int dist2light_idx = -1;
    int gloss_idx = -1;

	for (idx = 1; idx < argc; idx++) 
    {
		if (strcasecmp(argv[idx], "-root") == 0) {
			params->standalone = false;
		}

        else if (strcasecmp(argv[idx], "-verbose") == 0) {
			params->verbose = true;
		}

        else if (strcasecmp(argv[idx], "-log") == 0) {
			params->useLog = true;
		}

        else if (strcmp(argv[idx], "-delay") == 0) {
			delay_idx = idx + 1;
		}

        else if (strcmp(argv[idx], "-detail") == 0) {
			detail_idx = idx + 1;
		}

        else if (strcmp(argv[idx], "-interval") == 0) {
			interval_idx = idx + 1;
		}

        else if (strcmp(argv[idx], "-palette") == 0) {
			palette_idx = idx + 1;
		}

        else if (strcmp(argv[idx], "-light") == 0) {
			light_idx = idx + 1;
		}

        else if (strcmp(argv[idx], "-transparency") == 0) {
			transp_idx = idx + 1;
		}

        else if (strcmp(argv[idx], "-speed") == 0) {
			speed_idx = idx + 1;
		}

        else if (strcmp(argv[idx], "-dist_to_light") == 0) {
			dist2light_idx = idx + 1;
		}

        else if (strcmp(argv[idx], "-gloss") == 0) {
			gloss_idx = idx + 1;
		}

        else if (strcmp(argv[idx], "-onesided") == 0) {
			params->two_sided_light = false;
		}

        else if (strcmp(argv[idx], "-shuffle") == 0) {
			params->shuffle = false;
		}

        else if (strcmp(argv[idx], "-nosmooth") == 0) {
			params->smooth = false;
		}

        else if (idx == delay_idx)
        {
            params->delay_ms = atoi (argv[idx]); 
        }

        else if (idx == detail_idx)
        {
            params->detail = atoi (argv[idx]); 
        }
        else if (idx == interval_idx)
        {
            params->interval = atoi (argv[idx]); 
        }
        else if (idx == transp_idx)
        {
            params->transparency = atoi (argv[idx]); 
        }
        else if (idx == speed_idx)
        {
            params->speed = atoi (argv[idx]); 
        }

        else if (idx == dist2light_idx)
        {
            params->dist2light = atoi (argv[idx]); 
        }

        else if (idx == gloss_idx)
        {
            if (strcmp(argv[idx], "random"))
                params->gloss_level = -1;
            else     
                params->gloss_level = atoi (argv[idx]); 
        }

        else if (idx == palette_idx)
        {
            if (strcmp(argv[idx], "alt") == 0)
                params->palette = PALETTE_ALT; 
            if (strcmp(argv[idx], "std") == 0)
                params->palette = PALETTE_STD;
        }
        else if (idx == light_idx)
        {
            if (strcmp(argv[idx], "fixed") == 0)
                params->light_source = LIGHT_FIXED; 
            if (strcmp(argv[idx], "moving") == 0)
                params->light_source = LIGHT_MOVING;
        }

	}

	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x28(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x30(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x3c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x44b3
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa182(%rip), %rsi      # 0xe19a
callq 0x33e0
cmpl $0x0, %eax
jne 0x402e
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
jmp 0x44a3
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa15f(%rip), %rsi      # 0xe1a0
callq 0x33e0
cmpl $0x0, %eax
jne 0x4058
movq -0x18(%rbp), %rax
movb $0x1, 0x1(%rax)
jmp 0x44a1
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa13e(%rip), %rsi      # 0xe1a9
callq 0x33e0
cmpl $0x0, %eax
jne 0x4082
movq -0x18(%rbp), %rax
movb $0x1, 0x2(%rax)
jmp 0x449f
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa119(%rip), %rsi      # 0xe1ae
callq 0x3550
cmpl $0x0, %eax
jne 0x40ad
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x449d
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa0f5(%rip), %rsi      # 0xe1b5
callq 0x3550
cmpl $0x0, %eax
jne 0x40d8
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x449b
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa0d2(%rip), %rsi      # 0xe1bd
callq 0x3550
cmpl $0x0, %eax
jne 0x4103
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4499
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa0b1(%rip), %rsi      # 0xe1c7
callq 0x3550
cmpl $0x0, %eax
jne 0x412e
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x4497
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa08f(%rip), %rsi      # 0xe1d0
callq 0x3550
cmpl $0x0, %eax
jne 0x4159
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x4495
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa06b(%rip), %rsi      # 0xe1d7
callq 0x3550
cmpl $0x0, %eax
jne 0x4184
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x4493
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa04e(%rip), %rsi      # 0xe1e5
callq 0x3550
cmpl $0x0, %eax
jne 0x41af
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x4491
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa02a(%rip), %rsi      # 0xe1ec
callq 0x3550
cmpl $0x0, %eax
jne 0x41da
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x448f
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa00e(%rip), %rsi      # 0xe1fb
callq 0x3550
cmpl $0x0, %eax
jne 0x4205
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x448d
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9fea(%rip), %rsi      # 0xe202
callq 0x3550
cmpl $0x0, %eax
jne 0x422f
movq -0x18(%rbp), %rax
movb $0x0, 0x2c(%rax)
jmp 0x448b
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9fca(%rip), %rsi      # 0xe20c
callq 0x3550
cmpl $0x0, %eax
jne 0x4259
movq -0x18(%rbp), %rax
movb $0x0, 0x2d(%rax)
jmp 0x4489
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9fa9(%rip), %rsi      # 0xe215
callq 0x3550
cmpl $0x0, %eax
jne 0x4286
movq -0x18(%rbp), %rax
movl $0x0, 0x30(%rax)
jmp 0x4487
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x42ad
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3630
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x4485
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0x42d4
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3630
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
jmp 0x4483
movl -0x1c(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x42fb
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3630
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xc(%rax)
jmp 0x4481
movl -0x1c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x4322
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3630
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x447f
movl -0x1c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jne 0x4349
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3630
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
jmp 0x447d
movl -0x1c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jne 0x4370
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3630
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
jmp 0x447b
movl -0x1c(%rbp), %eax
cmpl -0x40(%rbp), %eax
jne 0x43c1
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xa25a(%rip), %rsi      # 0xe5e5
callq 0x3550
cmpl $0x0, %eax
je 0x43a2
movq -0x18(%rbp), %rax
movl $0xffffffff, 0x28(%rax) # imm = 0xFFFFFFFF
jmp 0x43bc
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3630
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0x4479
movl -0x1c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0x441b
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9e43(%rip), %rsi      # 0xe21f
callq 0x3550
cmpl $0x0, %eax
jne 0x43f1
movq -0x18(%rbp), %rax
movl $0x1, 0x10(%rax)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9e1f(%rip), %rsi      # 0xe223
callq 0x3550
cmpl $0x0, %eax
jne 0x4419
movq -0x18(%rbp), %rax
movl $0x0, 0x10(%rax)
jmp 0x4477
movl -0x1c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0x4475
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9df1(%rip), %rsi      # 0xe227
callq 0x3550
cmpl $0x0, %eax
jne 0x444b
movq -0x18(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9dcf(%rip), %rsi      # 0xe22d
callq 0x3550
cmpl $0x0, %eax
jne 0x4473
movq -0x18(%rbp), %rax
movl $0x1, 0x14(%rax)
jmp 0x4475
jmp 0x4477
jmp 0x4479
jmp 0x447b
jmp 0x447d
jmp 0x447f
jmp 0x4481
jmp 0x4483
jmp 0x4485
jmp 0x4487
jmp 0x4489
jmp 0x448b
jmp 0x448d
jmp 0x448f
jmp 0x4491
jmp 0x4493
jmp 0x4495
jmp 0x4497
jmp 0x4499
jmp 0x449b
jmp 0x449d
jmp 0x449f
jmp 0x44a1
jmp 0x44a3
jmp 0x44a5
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x3ff9
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)