// File: CastellanZhang[P]lambdaFM/./src/FTRL/ftrl_trainer.h
// Function: ftrl_trainer::trainGroup(std::vector<fm_sample, std::allocator<fm_sample>>&)
void ftrl_trainer::trainGroup(vector<fm_sample>& sampleGrp)
{
    int size = sampleGrp.size();
    variable_NDCG v_NDCG;
    if("ndcg" == rank)
    {
        v_NDCG.init(size);
        calcVariables4NDCG(sampleGrp, v_NDCG);
    }
    for(int i = 0; i < size - 1; ++i)
    {
        for(int j = i + 1; j < size; ++j)
        {
            if(sampleGrp[i].y == sampleGrp[j].y)
            {
                continue;
            }
            double deltaNDCG = 1.0;
            if("ndcg" == rank)
            {
                deltaNDCG = calcDeltaNDCG(i, j, v_NDCG);
            }
            if(sampleGrp[i].y > sampleGrp[j].y)
            {
                trainPair(sampleGrp[i], sampleGrp[j], deltaNDCG);
            }
            else if(sampleGrp[i].y < sampleGrp[j].y)
            {
                trainPair(sampleGrp[j], sampleGrp[i], deltaNDCG);
            }
        }
    }
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0xc8(%rsp), %rdi
callq 0x8f60
movl %eax, 0xc4(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x8f80
movq 0x38(%rsp), %rsi
addq $0x58, %rsi
leaq 0x15d64(%rip), %rdi     # 0x1b046
callq 0x8fc0
movb %al, 0x47(%rsp)
jmp 0x52ed
movb 0x47(%rsp), %al
testb $0x1, %al
jne 0x52f7
jmp 0x5342
movl 0xc4(%rsp), %esi
leaq 0x68(%rsp), %rdi
callq 0x8ff0
jmp 0x530a
movq 0x38(%rsp), %rdi
movq 0xc8(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x5550
jmp 0x5323
jmp 0x5342
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x9170
jmp 0x5541
movl $0x0, 0x58(%rsp)
movl 0x58(%rsp), %eax
movl 0xc4(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x552f
movl 0x58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
movl 0x54(%rsp), %eax
cmpl 0xc4(%rsp), %eax
jge 0x551d
movq 0xc8(%rsp), %rdi
movslq 0x58(%rsp), %rsi
callq 0x9040
movl (%rax), %eax
movl %eax, 0x34(%rsp)
movq 0xc8(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x9040
movq %rax, %rcx
movl 0x34(%rsp), %eax
cmpl (%rcx), %eax
jne 0x53b6
jmp 0x550d
movq 0x38(%rsp), %rsi
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x48(%rsp)
addq $0x58, %rsi
leaq 0x15c71(%rip), %rdi     # 0x1b046
callq 0x8fc0
movb %al, 0x33(%rsp)
jmp 0x53e0
movb 0x33(%rsp), %al
testb $0x1, %al
jne 0x53ea
jmp 0x5415
movq 0x38(%rsp), %rdi
movl 0x58(%rsp), %esi
movl 0x54(%rsp), %edx
leaq 0x68(%rsp), %rcx
callq 0x9060
movsd %xmm0, 0x28(%rsp)
jmp 0x5409
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
movq 0xc8(%rsp), %rdi
movslq 0x58(%rsp), %rsi
callq 0x9040
movl (%rax), %eax
movl %eax, 0x24(%rsp)
movq 0xc8(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x9040
movq %rax, %rcx
movl 0x24(%rsp), %eax
cmpl (%rcx), %eax
jle 0x548f
movq 0xc8(%rsp), %rdi
movslq 0x58(%rsp), %rsi
callq 0x9040
movq %rax, 0x18(%rsp)
movq 0xc8(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x9040
movq 0x38(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rax, %rdx
movsd 0x48(%rsp), %xmm0
callq 0x5770
jmp 0x548d
jmp 0x550b
movq 0xc8(%rsp), %rdi
movslq 0x58(%rsp), %rsi
callq 0x9040
movl (%rax), %eax
movl %eax, 0x14(%rsp)
movq 0xc8(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x9040
movq %rax, %rcx
movl 0x14(%rsp), %eax
cmpl (%rcx), %eax
jge 0x5509
movq 0xc8(%rsp), %rdi
movslq 0x54(%rsp), %rsi
callq 0x9040
movq %rax, 0x8(%rsp)
movq 0xc8(%rsp), %rdi
movslq 0x58(%rsp), %rsi
callq 0x9040
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rax, %rdx
movsd 0x48(%rsp), %xmm0
callq 0x5770
jmp 0x5507
jmp 0x5509
jmp 0x550b
jmp 0x550d
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
jmp 0x536b
jmp 0x551f
movl 0x58(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x58(%rsp)
jmp 0x534a
leaq 0x68(%rsp), %rdi
callq 0x9170
addq $0xd8, %rsp
retq
movq 0x60(%rsp), %rdi
callq 0x3490
nopl (%rax,%rax)