// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
subq $0x10, %rsp
addl 0x8(%rdi), %esi
movl %esi, %eax
cltd
idivl 0xc(%rdi)
movl %eax, %ebp
movslq %esi, %rax
imulq $0x10624dd3, %rax, %rcx # imm = 0x10624DD3
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x26, %rcx
addl %edx, %ecx
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
subl %ecx, %eax
movl %eax, 0x8(%rdi)
testl %ebp, %ebp
je 0x1c19
movq %rdi, %rbx
leaq 0x16b7(%rip), %r14      # 0x30ca
leaq 0x8(%rsp), %r15
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
leaq (%rax,%rax,4), %rdx
shlq $0x4, %rdx
movq 0x10(%rdi,%rdx), %rcx
cmpq %rcx, 0x30(%rdi,%rdx)
je 0x1ac5
addq %rdx, %rdi
movq (%rcx), %r12
callq 0x2496
movq (%r12), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq (%r12), %rdi
callq 0x142a
movq (%r12), %rsi
testb %al, %al
je 0x1a86
movq %rbx, %rdi
callq 0x16ca
jmp 0x1a98
testq %rsi, %rsi
je 0x1a94
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x8(%rax)
lock
decl 0x28(%rbx)
movl $0x18, %esi
movq %r12, %rdi
callq 0x10a0
movslq 0x14(%rbx), %rax
movq 0x30(%rbx), %rdx
leaq (%rax,%rax,4), %rsi
shlq $0x4, %rsi
leaq (%rdx,%rsi), %rdi
movq 0x10(%rdx,%rsi), %rcx
cmpq %rcx, 0x30(%rdx,%rsi)
jne 0x1a59
incl %eax
cltd
idivl 0x10(%rbx)
testl %eax, %eax
je 0x1c11
movl 0x18(%rbx), %ecx
movl 0x1c(%rbx), %eax
incl %eax
cltd
idivl %ecx
movl %edx, %eax
movl %edx, 0x1c(%rbx)
movslq %edx, %rdx
movq 0x48(%rbx), %rdi
leaq (%rdx,%rdx,4), %rsi
shlq $0x4, %rsi
movq 0x10(%rdi,%rsi), %rdx
cmpq %rdx, 0x30(%rdi,%rsi)
je 0x1b6f
addq %rsi, %rdi
movq (%rdx), %rax
movq %rax, 0x8(%rsp)
callq 0x2496
movq 0x8(%rsp), %rax
movslq 0x10(%rax), %rcx
movq 0x30(%rbx), %rdx
leaq (%rcx,%rcx,4), %rsi
shlq $0x4, %rsi
leaq (%rdx,%rsi), %rdi
movq 0x30(%rdx,%rsi), %rcx
movq 0x40(%rdx,%rsi), %rdx
addq $-0x8, %rdx
cmpq %rdx, %rcx
je 0x1b44
movq %rax, (%rcx)
addq $0x8, 0x30(%rdi)
jmp 0x1b4c
movq %r15, %rsi
callq 0x24e4
movslq 0x1c(%rbx), %rax
movq 0x48(%rbx), %rcx
leaq (%rax,%rax,4), %rsi
shlq $0x4, %rsi
leaq (%rcx,%rsi), %rdi
movq 0x10(%rcx,%rsi), %rdx
cmpq %rdx, 0x30(%rcx,%rsi)
jne 0x1b01
movl 0x18(%rbx), %ecx
incl %eax
cltd
idivl %ecx
testl %eax, %eax
je 0x1c11
movl 0x24(%rbx), %eax
incl %eax
cltd
idivl 0x20(%rbx)
movl %edx, 0x24(%rbx)
movslq %edx, %rax
movq 0x60(%rbx), %rdi
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
movq 0x10(%rdi,%rcx), %rax
cmpq %rax, 0x30(%rdi,%rcx)
je 0x1c11
addq %rcx, %rdi
movq (%rax), %rax
movq %rax, 0x8(%rsp)
callq 0x2496
movq 0x8(%rsp), %rax
movslq 0xc(%rax), %rcx
movq 0x48(%rbx), %rdx
leaq (%rcx,%rcx,4), %rsi
shlq $0x4, %rsi
leaq (%rdx,%rsi), %rdi
movq 0x30(%rdx,%rsi), %rcx
movq 0x40(%rdx,%rsi), %rdx
addq $-0x8, %rdx
cmpq %rdx, %rcx
je 0x1be9
movq %rax, (%rcx)
addq $0x8, 0x30(%rdi)
jmp 0x1bf1
movq %r15, %rsi
callq 0x24e4
movslq 0x24(%rbx), %rax
movq 0x60(%rbx), %rcx
leaq (%rax,%rax,4), %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rdi
movq 0x10(%rcx,%rdx), %rax
cmpq %rax, 0x30(%rcx,%rdx)
jne 0x1ba6
decl %ebp
jne 0x1a18
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq