// File: /workspace/github_cpp_makefile_star2_O2/BrianYi[P]timer/src/AdvanceTimeWheel.h
// Function: AdvanceTimeWheel::run(int)
void run(int milliseconds)
    {
        fMilliSec += milliseconds;
        int passedSec = fMilliSec / fSecFreq;
        fMilliSec %= 1000;
        while (passedSec--)
        {
            fSecPtr=(fSecPtr+1)%fSecWheelSize;
#if 1
            printf("Time %02d:%02d:%02d\r\n", fHourPtr, fMinPtr, fSecPtr);
#endif
            while (!fSecWheel[fSecPtr].empty())
            {
                ListNode* node = fSecWheel[fSecPtr].front();
                fSecWheel[fSecPtr].pop();
                node->timer->callback();
                if (node->timer->needRepeat())
                {
                    addTimer(node->timer);
                }
                else
                {
                    delete node->timer;
                    fTotalTimerNum--;
                }
                delete node;
            }
            
            if ((fSecPtr+1)/fSecWheelSize)
            {
                fMinPtr=(fMinPtr+1)%fMinWheelSize;
                while (!fMinWheel[fMinPtr].empty())
                {
                    ListNode* minNode = fMinWheel[fMinPtr].front();
                    fMinWheel[fMinPtr].pop();
                    fSecWheel[minNode->sec].push(minNode);
                }

                if ((fMinPtr+1)/fMinWheelSize)
                {
                    fHourPtr=(fHourPtr+1)%fHourWheelSize;
                    while (!fHourWheel[fHourPtr].empty())
                    {
                        ListNode* hourNode = fHourWheel[fHourPtr].front();
                        fHourWheel[fHourPtr].pop();
                        fMinWheel[hourNode->min].push(hourNode);
                    }
                }
            }
        } 
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
addl 0x8(%rdi), %esi
movl %esi, %eax
cltd
idivl 0xc(%rdi)
movl %eax, %ebp
movl $0x3e8, %ecx            # imm = 0x3E8
movl %esi, %eax
cltd
idivl %ecx
movl %edx, 0x8(%rdi)
leaq 0x17c7(%rip), %r14      # 0x30ca
movq %rsp, %r15
pushq $0x18
popq %r12
subl $0x1, %ebp
jb 0x1a5d
movl 0x14(%rbx), %eax
movl 0x1c(%rbx), %r8d
incl %eax
cltd
idivl 0x10(%rbx)
movl %edx, %ecx
movl %edx, 0x14(%rbx)
movl 0x24(%rbx), %esi
movq %r14, %rdi
movl %r8d, %edx
xorl %eax, %eax
callq 0x1030
movslq 0x14(%rbx), %rax
movq 0x30(%rbx), %rdi
imulq $0x50, %rax, %rdx
movq 0x10(%rdi,%rdx), %rcx
cmpq %rcx, 0x30(%rdi,%rdx)
je 0x199c
addq %rdx, %rdi
movq (%rcx), %r13
callq 0x24e8
movq (%r13), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq (%r13), %rdi
callq 0x140e
movq (%r13), %rsi
testb %al, %al
je 0x197d
movq %rbx, %rdi
callq 0x1698
jmp 0x198f
testq %rsi, %rsi
je 0x198b
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x8(%rax)
lock
decl 0x28(%rbx)
movq %r13, %rdi
movq %r12, %rsi
callq 0x10a0
jmp 0x1935
incl %eax
cltd
idivl 0x10(%rbx)
testl %eax, %eax
je 0x190a
movl 0x1c(%rbx), %eax
incl %eax
cltd
idivl 0x18(%rbx)
movl %edx, %eax
movl %edx, 0x1c(%rbx)
movslq %eax, %rcx
movq 0x48(%rbx), %rdi
imulq $0x50, %rcx, %rdx
movq 0x10(%rdi,%rdx), %rcx
cmpq %rcx, 0x30(%rdi,%rdx)
je 0x19fb
addq %rdx, %rdi
movq (%rcx), %rax
movq %rax, (%rsp)
callq 0x24e8
movq (%rsp), %rax
movslq 0x10(%rax), %rax
imulq $0x50, %rax, %rdi
addq 0x30(%rbx), %rdi
movq %r15, %rsi
callq 0x253e
movl 0x1c(%rbx), %eax
jmp 0x19b8
incl %eax
cltd
idivl 0x18(%rbx)
testl %eax, %eax
je 0x190a
movl 0x24(%rbx), %eax
incl %eax
cltd
idivl 0x20(%rbx)
movl %edx, 0x24(%rbx)
movslq %edx, %rax
movq 0x60(%rbx), %rcx
imulq $0x50, %rax, %rdx
leaq (%rcx,%rdx), %rdi
movq 0x10(%rcx,%rdx), %rax
cmpq %rax, 0x30(%rcx,%rdx)
je 0x190a
movq (%rax), %rax
movq %rax, (%rsp)
callq 0x24e8
movq (%rsp), %rax
movslq 0xc(%rax), %rax
imulq $0x50, %rax, %rdi
addq 0x48(%rbx), %rdi
movq %r15, %rsi
callq 0x253e
movl 0x24(%rbx), %edx
jmp 0x1a15
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq