// File: /workspace/github_cpp_makefile_star2_O1/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 0x2c45
movq %rdi, %rbx
leaq 0x167f(%rip), %r14      # 0x40ba
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 0x2030
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 0x2aed
addq %rdx, %rdi
movq (%rcx), %r12
callq 0x3526
movq (%r12), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq (%r12), %rdi
callq 0x243a
movq (%r12), %rsi
testb %al, %al
je 0x2aae
movq %rbx, %rdi
callq 0x26e2
jmp 0x2ac0
testq %rsi, %rsi
je 0x2abc
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x8(%rax)
lock
decl 0x28(%rbx)
movl $0x18, %esi
movq %r12, %rdi
callq 0x20a0
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 0x2a81
incl %eax
cltd
idivl 0x10(%rbx)
testl %eax, %eax
je 0x2c3d
movl 0x1c(%rbx), %eax
incl %eax
cltd
idivl 0x18(%rbx)
movl %edx, %eax
movl %edx, 0x1c(%rbx)
movslq %edx, %rcx
movq 0x48(%rbx), %rdi
leaq (%rcx,%rcx,4), %rcx
shlq $0x4, %rcx
movq 0x30(%rdi,%rcx), %rdx
cmpq 0x10(%rdi,%rcx), %rdx
je 0x2b96
addq %rcx, %rdi
movq 0x10(%rdi), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
callq 0x3526
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 0x2b6e
movq %rax, (%rcx)
addq $0x8, 0x30(%rdi)
jmp 0x2b76
movq %r15, %rsi
callq 0x3574
movslq 0x1c(%rbx), %rax
movq 0x48(%rbx), %rcx
leaq (%rax,%rax,4), %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rdi
movq 0x30(%rcx,%rdx), %rsi
cmpq 0x10(%rcx,%rdx), %rsi
jne 0x2b27
incl %eax
cltd
idivl 0x18(%rbx)
testl %eax, %eax
je 0x2c3d
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), %rax
shlq $0x4, %rax
movq 0x30(%rdi,%rax), %rcx
cmpq 0x10(%rdi,%rax), %rcx
je 0x2c3d
addq %rax, %rdi
movq 0x10(%rdi), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
callq 0x3526
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 0x2c15
movq %rax, (%rcx)
addq $0x8, 0x30(%rdi)
jmp 0x2c1d
movq %r15, %rsi
callq 0x3574
movslq 0x24(%rbx), %rax
movq 0x60(%rbx), %rcx
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdi
movq 0x30(%rcx,%rax), %rdx
cmpq 0x10(%rcx,%rax), %rdx
jne 0x2bce
decl %ebp
jne 0x2a40
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq