// File: /workspace/github_c_makefile_star2_O3/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 0x16ef9
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 0x13dc1
movq %rax, %rbx
leaq 0x60ab(%rip), %rsi      # 0x1cfb3
movq %rax, %rdi
callq 0x8220
testl %eax, %eax
je 0x16f2b
leaq 0x50dc(%rip), %rsi      # 0x1bff7
movq %rbx, %rdi
callq 0x8220
testl %eax, %eax
jne 0x17030
cmpl $-0x1, 0x12fb6(%rip)    # 0x29ee8
jne 0x16f51
leaq 0x20d255(%rip), %rdi    # 0x224190
movl $0x800, %edx            # imm = 0x800
xorl %esi, %esi
callq 0x81b0
movl $0x0, 0x12f97(%rip)     # 0x29ee8
cmpb $0x0, 0x208f10(%rip)    # 0x21fe68
jne 0x17030
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 0x20c206(%rip), %rbx    # 0x223190
leaq 0x7cd6(%rip), %rdx      # 0x1ec67
movl $0x50, %esi
movq %rbx, %rdi
callq 0x80c0
movq %rbx, %rdi
callq 0x8120
xorl %r14d, %r14d
testl %eax, %eax
jle 0x16fcb
movl $0xff, %ecx
cmpl %ecx, %eax
cmovbl %eax, %ecx
xorl %eax, %eax
movzbl (%rax,%rbx), %edx
addl %edx, %r14d
incq %rax
cmpq %rax, %rcx
jne 0x16fb9
movl %r14d, %r14d
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x82a0
movq %rax, %rbx
leaq 0x20d1b1(%rip), %r15    # 0x224190
cmpq (%r12,%r15), %rbx
jne 0x16fec
cmpq 0x8(%r12,%r15), %r14
je 0x17007
addq $0x10, %r12
cmpq $0x800, %r12            # imm = 0x800
jne 0x16fdf
leaq 0x20c190(%rip), %rdi    # 0x223190
xorl %eax, %eax
callq 0x13337
movslq 0x12eda(%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, 0x12eb8(%rip)     # 0x29ee8
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq