// File: /workspace/github_c_makefile_star2_O1/schroeder-lvb[P]sissm/src/piantirush.c
// Function: localSayThrottled
static int _localSayThrottled( const char * format, ... )
{
    static char buffer[API_T_BUFSIZE];
    int errCode = 0, i, suppressPrint;
    unsigned long checksum, timeNow;
    char *v;

    // a wedge code to disable this plugin if non-Checkpoint mode is running 
    //
    v = apiGetServerMode();
    if (! ((0==strcmp( v, "checkpoint" )) || (0==strcmp( v, "hardcore"))) )  return 0;

    if ( throttleIndex == -1 )  {
         memset( &throttle[0][0], 0, sizeof(long)*THROTTLE_HISTO*2 );
         throttleIndex = 0;
    }

    if ( 0 == _localMute ) {
        va_list args;
        va_start( args, format );
        vsnprintf( buffer, (API_T_BUFSIZE >= API_MAXSAY) ? API_MAXSAY : API_T_BUFSIZE, format, args );

        checksum = _fastChecksum( buffer );
        timeNow  = (unsigned long ) time(NULL);

        suppressPrint = 0;
        for ( i = 0; i<THROTTLE_HISTO; i++ ) {
            if ( (timeNow ) == throttle[i][0] ) {
                if ( checksum == throttle[i][1] ) {
                    suppressPrint = 1;
                    break;
                }
            }
        }

        if ( 0 == suppressPrint ) errCode = apiSay( buffer );

        throttle[ throttleIndex ][0] = timeNow;
        throttle[ throttleIndex ][1] = checksum;
        if ( (++throttleIndex) >= THROTTLE_HISTO ) throttleIndex = 0;

        va_end (args);
    }
    return errCode;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x16cc0
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
callq 0x13a76
movq %rax, %rbx
leaq 0x630c(%rip), %rsi      # 0x1cfdb
movq %rax, %rdi
callq 0x8220
testl %eax, %eax
je 0x16cf2
leaq 0x531d(%rip), %rsi      # 0x1bfff
movq %rbx, %rdi
callq 0x8220
testl %eax, %eax
jne 0x16e02
cmpl $-0x1, 0x131ef(%rip)    # 0x29ee8
jne 0x16d18
leaq 0x20d48e(%rip), %rdi    # 0x224190
movl $0x800, %edx            # imm = 0x800
xorl %esi, %esi
callq 0x81b0
movl $0x0, 0x131d0(%rip)     # 0x29ee8
cmpb $0x0, 0x209149(%rip)    # 0x21fe68
jne 0x16e02
leaq 0x20(%rsp), %rax
movq %rsp, %rcx
movq %rax, 0x10(%rcx)
leaq 0x100(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rcx)
leaq 0x20c43f(%rip), %rbx    # 0x223190
leaq 0x7f27(%rip), %rdx      # 0x1ec7f
movl $0x50, %esi
movq %rbx, %rdi
callq 0x80c0
movq %rbx, %rdi
callq 0x8120
xorl %r14d, %r14d
testl %eax, %eax
jle 0x16d9d
movl $0xff, %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
cmpl $0x2, %ecx
movl $0x1, %eax
cmovgel %ecx, %eax
xorl %ecx, %ecx
movzbl (%rcx,%rbx), %edx
addl %edx, %r14d
incq %rcx
cmpq %rcx, %rax
jne 0x16d8b
movl %r14d, %r14d
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x82a0
movq %rax, %rbx
leaq 0x20d3df(%rip), %r15    # 0x224190
cmpq (%r12,%r15), %rbx
jne 0x16dbe
cmpq 0x8(%r12,%r15), %r14
je 0x16dd9
addq $0x10, %r12
cmpq $0x800, %r12            # imm = 0x800
jne 0x16db1
leaq 0x20c3be(%rip), %rdi    # 0x223190
xorl %eax, %eax
callq 0x12fba
movslq 0x13108(%rip), %rax     # 0x29ee8
movq %rax, %rcx
shlq $0x4, %rcx
leal 0x1(%rax), %edx
xorl %esi, %esi
cmpq $0x7f, %rax
movq %rbx, (%rcx,%r15)
movq %r14, 0x8(%rcx,%r15)
cmovll %edx, %esi
movl %esi, 0x130e6(%rip)     # 0x29ee8
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq