I am new to assembly and have a simple C program printing a string to stdout. In assembly, this translates to main
calling _IO_Puts
. The implementation of _IO_puts
is as below taken from: https://code.woboq.org/userspace/glibc/libio/ioputs.c.html is given below.
int
_IO_puts (const char *str)
{
int result = EOF;
size_t len = strlen (str);
_IO_acquire_lock (stdout);
if ((_IO_vtable_offset (stdout) != 0
|| _IO_fwide (stdout, -1) == -1)
&& _IO_sputn (stdout, str, len) == len
&& _IO_putc_unlocked ('\n', stdout) != EOF)
result = MIN (INT_MAX, len + 1);
_IO_release_lock (stdout);
return result;
}
I am unable to figure out why the number of dynamic instructions change and sometimes decrease with increase in the string length on a simulates MIPS processor?