// File: UCBASiCS[P]SPRIGHT/src/config.cpp
// Function: Config::setOptionsFromCommandLine()
void Config::setOptionsFromCommandLine()
{

    const struct option longOptions[] =
    {	
       {"experiment",	 no_argument,	    NULL, 'a'},
       {"bins",	 required_argument, NULL, 'b'},
       {"samples",      no_argument,       NULL, 'c'},
       {"chains",       required_argument, NULL, 'e'},
       {"file",         required_argument, NULL, 'f'},
       {"write",        required_argument, NULL, 'w'},
       {"help",         no_argument,       NULL, 'h'},
       {"iterations",   required_argument, NULL, 'i'},
       {"sparsity",     required_argument, NULL, 'k'},
       {"ml",           no_argument,       NULL, 'l'},
       {"length",       required_argument, NULL, 'n'},
       {"optimize",     no_argument,       NULL, 'o'},
       {"reconstruct",  no_argument,       NULL, 'r'},
       {"snr",          required_argument, NULL, 's'},
       {"distribution", required_argument, NULL, 'u'},
       {"verbose",      no_argument,       NULL, 'v'},
       {0, 0, 0, 0}
   };

   int option = 0;

   while(option != -1)
   {
        option = getopt_long(argc, argv, "acf:e:hi:k:b:ln:op:rs:tu:vw:z:", longOptions, NULL); //abfgjuxyz
        switch (option)
        {
           case 'a':
           experimentMode = true;
           break;

           case 'b':
           setBins(optarg);
           break;

           case 'n':
           signalLengthOriginal = atoi(optarg);
           signalLogLength = floor(log2(signalLengthOriginal));
           signalLength = pow(2,signalLogLength);
           break;

           case 'c':
           countSamples = false;
           break;

           case 'e':
           chainsNb = atoi(optarg);
           defaultDelays = false;
           break;

           case 'f':
           inputFile = optarg;
           experimentMode = false;
           break;

           case 'h':
           help();
           break;

           case 'i':
           iterations = atoi(optarg);
           break;

           case 'k':
           signalSparsity = atoi(optarg);
           signalSparsityPeeling = atoi(optarg);
           break;

           case 'l':
           maximumLikelihood = true;
           break;

           case 'r':
           reconstructSignalInBackEnd = true;
           break;

           case 's':
           noisy = true;
           SNRdB = strtof(optarg, 0);
           break;

           case 'u':
           preprocessDistribution(optarg);
           break;

           case 'z':
           outputFile = optarg;
           break;

           case 'v':
           verbose = true;
           break;
       }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x240(%rbp)
leaq -0x230(%rbp), %rdi
leaq 0x21a28(%rip), %rsi     # 0x2f940
movl $0x220, %edx            # imm = 0x220
callq 0x4250
movl $0x0, -0x234(%rbp)
cmpl $-0x1, -0x234(%rbp)
je 0xe16c
movq -0x240(%rbp), %rax
movl (%rax), %edi
movq 0x8(%rax), %rsi
leaq 0x12cb7(%rip), %rdx     # 0x20c04
xorl %eax, %eax
movl %eax, %r8d
leaq -0x230(%rbp), %rcx
callq 0x44f0
movl %eax, -0x234(%rbp)
movl -0x234(%rbp), %eax
addl $-0x61, %eax
movl %eax, %ecx
movq %rcx, -0x248(%rbp)
subl $0x19, %eax
ja 0xe167
movq -0x248(%rbp), %rax
leaq 0x121c7(%rip), %rcx     # 0x20154
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x240(%rbp), %rax
movb $0x1, 0x10(%rax)
jmp 0xe167
movq -0x240(%rbp), %rdi
movq 0x22004(%rip), %rax     # 0x2ffb8
movq (%rax), %rsi
callq 0xf780
jmp 0xe167
movq 0x21ff0(%rip), %rax     # 0x2ffb8
movq (%rax), %rdi
callq 0x4490
movl %eax, %ecx
movq -0x240(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl 0x1c(%rax), %edi
callq 0xf9c0
callq 0x4510
movq -0x240(%rbp), %rax
cvttsd2si %xmm0, %ecx
movl %ecx, 0xb0(%rax)
movl 0xb0(%rax), %esi
movl $0x2, %edi
callq 0xa240
movq -0x240(%rbp), %rax
cvttsd2si %xmm0, %ecx
movl %ecx, 0x18(%rax)
jmp 0xe167
movq -0x240(%rbp), %rax
movb $0x0, 0x77(%rax)
jmp 0xe167
movq 0x21f84(%rip), %rax     # 0x2ffb8
movq (%rax), %rdi
callq 0x4490
movl %eax, %ecx
movq -0x240(%rbp), %rax
movl %ecx, 0x60(%rax)
movb $0x0, 0x98(%rax)
jmp 0xe167
movq -0x240(%rbp), %rax
movq 0x21f56(%rip), %rcx     # 0x2ffb8
movq (%rcx), %rcx
movq %rcx, 0xa0(%rax)
movb $0x0, 0x10(%rax)
jmp 0xe167
movq -0x240(%rbp), %rdi
callq 0xf1c0
jmp 0xe167
movq 0x21f2b(%rip), %rax     # 0x2ffb8
movq (%rax), %rdi
callq 0x4490
movl %eax, %ecx
movq -0x240(%rbp), %rax
movl %ecx, 0x14(%rax)
jmp 0xe167
movq 0x21f0b(%rip), %rax     # 0x2ffb8
movq (%rax), %rdi
callq 0x4490
movl %eax, %ecx
movq -0x240(%rbp), %rax
movl %ecx, 0x24(%rax)
movq 0x21ef0(%rip), %rax     # 0x2ffb8
movq (%rax), %rdi
callq 0x4490
movl %eax, %ecx
movq -0x240(%rbp), %rax
movl %ecx, 0x90(%rax)
jmp 0xe167
movq -0x240(%rbp), %rax
movb $0x1, 0x20(%rax)
jmp 0xe167
movq -0x240(%rbp), %rax
movb $0x1, 0x76(%rax)
jmp 0xe167
movq -0x240(%rbp), %rax
movb $0x1, 0x68(%rax)
movq 0x21ea8(%rip), %rax     # 0x2ffb8
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x43f0
movq -0x240(%rbp), %rax
movss %xmm0, 0x6c(%rax)
jmp 0xe167
movq -0x240(%rbp), %rdi
movq 0x21e80(%rip), %rax     # 0x2ffb8
movq (%rax), %rsi
callq 0xe180
jmp 0xe167
movq -0x240(%rbp), %rax
movq 0x21e68(%rip), %rcx     # 0x2ffb8
movq (%rcx), %rcx
movq %rcx, 0xa8(%rax)
jmp 0xe167
movq -0x240(%rbp), %rax
movb $0x1, 0x74(%rax)
jmp 0xdf2c
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
nopw %cs:(%rax,%rax)