// File: /workspace/github_c_makefile_star2_O2/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 0x15ed7
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 0x12f75
movq %rax, %rbx
leaq 0x60d5(%rip), %rsi      # 0x1bfbb
movq %rax, %rdi
callq 0x8220
testl %eax, %eax
je 0x15f09
leaq 0x50fe(%rip), %rsi      # 0x1aff7
movq %rbx, %rdi
callq 0x8220
testl %eax, %eax
jne 0x1600b
cmpl $-0x1, 0x13fd8(%rip)    # 0x29ee8
jne 0x15f2c
leaq 0x20e277(%rip), %rdi    # 0x224190
movl $0x800, %edx            # imm = 0x800
xorl %esi, %esi
callq 0x81b0
andl $0x0, 0x13fbc(%rip)     # 0x29ee8
cmpb $0x0, 0x209f35(%rip)    # 0x21fe68
jne 0x1600b
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 0x20d22b(%rip), %rbx    # 0x223190
leaq 0x7ce3(%rip), %rdx      # 0x1dc4f
pushq $0x50
popq %rsi
movq %rbx, %rdi
callq 0x80c0
movq %rbx, %rdi
callq 0x8120
movl $0xff, %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
cmovlel %eax, %ecx
xorl %edx, %edx
cmpl %eax, %ecx
je 0x15fa1
movzbl (%rax,%rbx), %esi
addl %esi, %edx
incq %rax
jmp 0x15f92
movl %edx, %r14d
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x82a0
movq %rax, %rbx
leaq 0x20e1d8(%rip), %r15    # 0x224190
cmpq $0x800, %r12            # imm = 0x800
je 0x15fd4
cmpq (%r12,%r15), %rbx
jne 0x15fce
cmpq %r14, 0x8(%r12,%r15)
je 0x15fe2
addq $0x10, %r12
jmp 0x15fb8
leaq 0x20d1b5(%rip), %rdi    # 0x223190
xorl %eax, %eax
callq 0x125a8
movslq 0x13eff(%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, 0x13edd(%rip)     # 0x29ee8
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq