// File: adrianphoulady[P]weighted-tsetlin-machine-cpp/./utils.h
// Function: update(int, char* const*, int&, double&, int&, double&, int&, bool&, bool&, bool&)
void update(int argc, char * const argv[], int &clauses, double &p, int &threshold, double &gamma, int &epochs, bool &shuffle, bool &write, bool &resume) {
    int opt;
    static char *optarg = nullptr;
    while ((opt = getopt(argc, argv, "c:p:t:g:e:n:s:r:w:h", optarg)) != -1)
        switch (opt) {
            case 'h':
                printf("-c clauses\n-p p\n-t threshold\n-g gamma\n-e epochs\n-n new rand\n-s shuffle\n-r resume\n-w write\n");
                break;
            case 'c':
                clauses = atoi(optarg);
                break;
            case 'p':
                p = atof(optarg);
                break;
            case 't':
                threshold = atoi(optarg);
                break;
            case 'g':
                gamma = atof(optarg);
                break;
            case 'e':
                epochs = atoi(optarg);
                break;
            case 'n':
                fastsrand(strcmp(optarg, "0")? atoi(optarg): time(nullptr));
                break;
            case 's':
                shuffle = strcmp(optarg, "0") && strcasecmp(optarg, "false");
                break;
            case 'r':
                resume =  strcmp(optarg, "0") && strcasecmp(optarg, "false");
                break;
            case 'w':
                write =  strcmp(optarg, "0") && strcasecmp(optarg, "false");
        }
}

// Assembly:
subq $0x58, %rsp
movq 0x78(%rsp), %rax
movq 0x70(%rsp), %rax
movq 0x68(%rsp), %rax
movq 0x60(%rsp), %rax
movl %edi, 0x54(%rsp)
movq %rsi, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x30(%rsp)
movq %r9, 0x28(%rsp)
movl 0x54(%rsp), %edi
movq 0x48(%rsp), %rsi
leaq 0x5abb(%rip), %rdx      # 0x80a0
leaq 0x9c1c(%rip), %rcx      # 0xc208
callq 0x24b0
movsbl %al, %eax
movl %eax, 0x24(%rsp)
cmpl $-0x1, %eax
je 0x27f9
movl 0x24(%rsp), %eax
addl $-0x63, %eax
movl %eax, %ecx
movq %rcx, 0x18(%rsp)
subl $0x14, %eax
ja 0x27f4
movq 0x18(%rsp), %rax
leaq 0x59e0(%rip), %rcx      # 0x8004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x5a80(%rip), %rdi      # 0x80b4
movb $0x0, %al
callq 0x2040
jmp 0x27f4
movq 0x9bc1(%rip), %rdi      # 0xc208
callq 0x2300
movl %eax, %ecx
movq 0x40(%rsp), %rax
movl %ecx, (%rax)
jmp 0x27f4
movq 0x9ba7(%rip), %rdi      # 0xc208
callq 0x2260
movq 0x38(%rsp), %rax
movsd %xmm0, (%rax)
jmp 0x27f4
movq 0x9b8d(%rip), %rdi      # 0xc208
callq 0x2300
movl %eax, %ecx
movq 0x30(%rsp), %rax
movl %ecx, (%rax)
jmp 0x27f4
movq 0x9b73(%rip), %rdi      # 0xc208
callq 0x2260
movq 0x28(%rsp), %rax
movsd %xmm0, (%rax)
jmp 0x27f4
movq 0x9b59(%rip), %rdi      # 0xc208
callq 0x2300
movl %eax, %ecx
movq 0x60(%rsp), %rax
movl %ecx, (%rax)
jmp 0x27f4
movq 0x9b3f(%rip), %rdi      # 0xc208
leaq 0x5a3f(%rip), %rsi      # 0x810f
callq 0x22d0
cmpl $0x0, %eax
je 0x26ef
movq 0x9b27(%rip), %rdi      # 0xc208
callq 0x2300
cltq
movq %rax, 0x10(%rsp)
jmp 0x26fd
xorl %eax, %eax
movl %eax, %edi
callq 0x21f0
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2800
jmp 0x27f4
movq 0x9af5(%rip), %rdi      # 0xc208
leaq 0x59f5(%rip), %rsi      # 0x810f
callq 0x22d0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0xf(%rsp)
je 0x2749
movq 0x9ad5(%rip), %rdi      # 0xc208
leaq 0x59d7(%rip), %rsi      # 0x8111
callq 0x2240
cmpl $0x0, %eax
setne %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %cl
movq 0x68(%rsp), %rax
andb $0x1, %cl
movb %cl, (%rax)
jmp 0x27f4
movq 0x9aa5(%rip), %rdi      # 0xc208
leaq 0x59a5(%rip), %rsi      # 0x810f
callq 0x22d0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0xe(%rsp)
je 0x2799
movq 0x9a85(%rip), %rdi      # 0xc208
leaq 0x5987(%rip), %rsi      # 0x8111
callq 0x2240
cmpl $0x0, %eax
setne %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %cl
movq 0x78(%rsp), %rax
andb $0x1, %cl
movb %cl, (%rax)
jmp 0x27f4
movq 0x9a58(%rip), %rdi      # 0xc208
leaq 0x5958(%rip), %rsi      # 0x810f
callq 0x22d0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0xd(%rsp)
je 0x27e6
movq 0x9a38(%rip), %rdi      # 0xc208
leaq 0x593a(%rip), %rsi      # 0x8111
callq 0x2240
cmpl $0x0, %eax
setne %al
movb %al, 0xd(%rsp)
movb 0xd(%rsp), %cl
movq 0x70(%rsp), %rax
andb $0x1, %cl
movb %cl, (%rax)
jmp 0x25d5
addq $0x58, %rsp
retq
nop