Strange out of order execution

The program is a household monitor that notes arrivals on our driveway ( magnetometers ), doors left open and so on. It writes to a Newhaven 2 x 16 display and sends a status byte to a smarter computer that plays an appropriate message message thru small speakers scattered around the house and operates a beeper. It works, but a couple of instructions are executed in reversed order and I need somebody with a deeper understanding of Arduinos or the IDE than I have to figure out why.

in the code, find p = digitalRead(MAIL_PIN);
If the mailbox has been opened a microswitch closes, a transmitter sends, a receiver receives and closes a relay - 5V is applied to the MAIL_PIN. If it stays up for the required number of loops it should print "Mailbox opened" to the Newhaven display, then call the mailbeeps subroutine which operates a noismaker. The delay between the print and the subr was just me trying to diagnose the problem. The problem is that the write to the display occurs after the beeps, regardless of the length of the delay, or if there is no delay.
I can live with it, but it is weird.

I tried to post the whole program but it was too long - not allowed. Just the problem section is shown.

// ----------------------------------------------------------  Check if mail sensor has changed ---------------------------------------------------

    p = digitalRead(MAIL_PIN);                           // Changed ?   
    if (p != mail_pin_val)
    {
        if (++mail_loops > MIN_DET_LOOPS)
        {
            mail_pin_val   = p;
            mail_loops     = 0;
            sendstat();
            if(p)
            {
                snprintf(buf1, sizeof buf1, "Mailbox opened");
                delay(100);
                mailbeeps();
            }    
            else     snprintf(buf1, sizeof buf1, "Mailbox closed");
            disp(buf1);
        }
    }
    else
    {
        if (mail_loops > 0)
        {
            mail_loops--;
        }
    }
}

the write to the display occurs after the beeps

That's the way it is written.
snprintf does not write to the display, it only creates the string in buf1 which is then written to the display by disp(buf1)

Pete