// File: myudelson[P]hmm-scalable/HMMProblemEloSt.cpp
// Function: HMMProblemEloSt::init(task*)
void HMMProblemEloSt::init(struct task *task) {
//    printf("HMMProblemEloSt::init\n");
    // parent init
    HMMProblemSt::init(task);
    // local init
    // init elo parameters, trackers (values and counts)
    NCAT nG = task->nG;
    this->param_elo_n = task->elo_param_values_n;
    this->param_elo = init1D<NUMBER>(this->param_elo_n);
    for(NPAR i=0; i<this->param_elo_n; i++) {
        this->param_elo[i] = task->elo_param_values[i];
    }
    this->gradient_elo = initToValue1D<NUMBER>(this->param_elo_n, 0);
    this->elo_count_g = initToValue1D<NCAT>((NDAT)nG, 0);
    this->elo_track_g = initToValue1D<NUMBER>((NDAT)nG, 0); // init on logit scale
    this->elo_track_t = initToValue1D<NUMBER>((NDAT)task->N, 0); // init on logit scale
    // init elo sensitivity function
//    NUMBER (HMMProblemEloSt::*sensitivity)(NDAT) = &HMMProblemEloSt::sensitivity_K;
    switch(this->task->elo_type)
    {
        case ELO_DIRECT_K: {
            this->sensitivity = &HMMProblemEloSt::sensitivity_K;
            break;
        }
        case ELO_UNS_REL_1_B: {
            this->sensitivity = &HMMProblemEloSt::sensitivity_U1b;
            break;
        }
        case ELO_UNS_REL_1_EXPB_0_01: {
            this->sensitivity = &HMMProblemEloSt::sensitivity_U1bexp0_01;
            break;
        }
        case ELO_O2Z_IN_B: {
            this->sensitivity = &HMMProblemEloSt::sensitivity_O2Z_IN_B;
            break;
        }
        default:
            fprintf(stderr,"Elo type specified (%d) is not supported.\n",this->task->elo_type);
            exit(1);
            break;
    }

    // init elo gradient function
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movq -0x10(%rbp), %rsi
callq 0x11360
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movl 0x904(%rcx), %ecx
movl %ecx, -0x14(%rbp)
movq -0x10(%rbp), %rcx
movb 0x30(%rcx), %cl
movb %cl, 0xf0(%rax)
movsbl 0xf0(%rax), %edi
callq 0x9da0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0xe0(%rax)
movb $0x0, -0x15(%rbp)
movq -0x20(%rbp), %rcx
movsbl -0x15(%rbp), %eax
movsbl 0xf0(%rcx), %ecx
cmpl %ecx, %eax
jge 0x19b01
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movsbq -0x15(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0xe0(%rax), %rax
movsbq -0x15(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movb -0x15(%rbp), %al
addb $0x1, %al
movb %al, -0x15(%rbp)
jmp 0x19abd
movq -0x20(%rbp), %rax
movsbl 0xf0(%rax), %edi
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x190f0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0xe8(%rax)
movl -0x14(%rbp), %edi
xorl %esi, %esi
callq 0x19650
movsd -0x30(%rbp), %xmm0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x100(%rax)
movl -0x14(%rbp), %edi
callq 0x190f0
movsd -0x30(%rbp), %xmm0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0xf8(%rax)
movq -0x10(%rbp), %rax
movl 0x8f8(%rax), %edi
callq 0x190f0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x108(%rax)
movq 0x68(%rax), %rax
movsbl 0x20(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x3, %eax
ja 0x19c28
movq -0x28(%rbp), %rax
leaq 0x29e0(%rip), %rcx      # 0x1c580
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
leaq 0xac(%rip), %rcx        # 0x19c60
movq %rcx, 0xd0(%rax)
movq $0x0, 0xd8(%rax)
jmp 0x19c56
movq -0x20(%rbp), %rax
leaq 0xaa(%rip), %rcx        # 0x19c80
movq %rcx, 0xd0(%rax)
movq $0x0, 0xd8(%rax)
jmp 0x19c56
movq -0x20(%rbp), %rax
leaq 0x12b(%rip), %rcx       # 0x19d20
movq %rcx, 0xd0(%rax)
movq $0x0, 0xd8(%rax)
jmp 0x19c56
movq -0x20(%rbp), %rax
leaq 0x1dc(%rip), %rcx       # 0x19df0
movq %rcx, 0xd0(%rax)
movq $0x0, 0xd8(%rax)
jmp 0x19c56
movq -0x20(%rbp), %rax
movq 0x83a5(%rip), %rcx      # 0x21fd8
movq (%rcx), %rdi
movq 0x68(%rax), %rax
movsbl 0x20(%rax), %edx
leaq 0x29ad(%rip), %rsi      # 0x1c5f2
movb $0x0, %al
callq 0x33c0
movl $0x1, %edi
callq 0x3330
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)