--- ./microbench/util.c.save	Sun Mar 24 18:04:54 2019
+++ ./microbench/util.c	Sun Mar 24 18:05:35 2019
@@ -95,7 +95,7 @@
 	return counter_diff (&start, &end) / count ;
 } /* benchmark_function */
 
-#elif defined HAVE_CLOCK_GETTIME
+#elif defined(HAVE_CLOCK_GETTIME) && !defined(__sgi)
 
 #include <time.h>
 #include <sys/time.h>
--- ./include/FLAC/ordinals.h.save	Sun Mar 24 17:45:28 2019
+++ ./include/FLAC/ordinals.h	Sun Mar 24 17:48:14 2019
@@ -53,7 +53,11 @@
 
 /* For MSVC 2010 and everything else which provides <stdint.h>. */
 
-#include <stdint.h>
+#if defined(__sgi) && !defined(__GNUC__) && defined(_LANGUAGE_C_PLUS_PLUS)
+# include <inttypes.h>
+#else
+# include <stdint.h>
+#endif
 
 typedef int8_t FLAC__int8;
 typedef uint8_t FLAC__uint8;
--- ./include/share/alloc.h.save	Sun Mar 24 16:53:30 2019
+++ ./include/share/alloc.h	Sun Mar 24 17:05:30 2019
@@ -43,7 +43,11 @@
 
 #include <limits.h> /* for SIZE_MAX */
 #if HAVE_STDINT_H
-#include <stdint.h> /* for SIZE_MAX in case limits.h didn't get it */
+# if defined(__sgi) && !defined(__GNUC__) && defined(_LANGUAGE_C_PLUS_PLUS)
+#  include <inttypes.h>
+# else
+#  include <stdint.h> /* for SIZE_MAX in case limits.h didn't get it */
+# endif
 #endif
 #include <stdlib.h> /* for size_t, malloc(), etc */
 #include "share/compat.h"
@@ -57,7 +61,14 @@
 #    define SIZE_T_MAX 0xffffffff
 #   endif
 #  else
-#   error
+#   ifdef __sgi
+#    if (_MIPS_SZLONG == 32)
+#     define SIZE_T_MAX                UINT32_MAX
+#    endif
+#    if (_MIPS_SZLONG == 64)
+#     define SIZE_T_MAX                UINT64_MAX
+#    endif
+#   endif
 #  endif
 # endif
 # define SIZE_MAX SIZE_T_MAX
--- ./include/share/compat.h.save	Fri Apr 12 10:43:01 2019
+++ ./include/share/compat.h	Fri Apr 12 10:56:13 2019
@@ -144,6 +144,15 @@
 #  endif
 #endif /* defined _MSC_VER */
 
+#if defined __sgi
+#  ifndef PRIu64
+#    define PRIu64 "llu"
+#    define PRId64 "lld"
+#    define PRIx64 "llx"
+#  endif
+#endif /* defined __sgi */
+
+
 #ifdef _WIN32
 /* All char* strings are in UTF-8 format. Added to support Unicode files on Windows */
 
--- ./src/flac/encode.c.save	Sun Mar 24 19:56:09 2019
+++ ./src/flac/encode.c	Sun Mar 24 19:56:30 2019
@@ -1387,9 +1387,9 @@
 			case FORMAT_AIFF_C:
 				while(encoder_session.fmt.iff.data_bytes > 0) {
 					const size_t bytes_to_read =
-						min (sizeof (ubuffer.u8),
-							min ((size_t)encoder_session.fmt.iff.data_bytes,
-								CHUNK_OF_SAMPLES * (size_t)encoder_session.info.bytes_per_wide_sample));
+						(size_t) min (sizeof (ubuffer.u8),
+							min (encoder_session.fmt.iff.data_bytes,
+								CHUNK_OF_SAMPLES * encoder_session.info.bytes_per_wide_sample));
 					size_t bytes_read = fread(ubuffer.u8, sizeof(unsigned char), bytes_to_read, infile);
 					if(bytes_read == 0) {
 						if(ferror(infile)) {
--- ./src/libFLAC/bitwriter.c.save	Sun Mar 24 16:23:55 2019
+++ ./src/libFLAC/bitwriter.c	Sun Mar 24 16:25:53 2019
@@ -96,7 +96,7 @@
 };
 
 /* * WATCHOUT: The current implementation only grows the buffer. */
-#ifndef __SUNPRO_C
+#if !defined(__SUNPRO_C) && !defined(__sgi)
 static
 #endif
 FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add)
@@ -318,8 +318,10 @@
 	}
 	return true;
 }
-
-static inline FLAC__bool FLAC__bitwriter_write_raw_uint32_nocheck(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits)
+#ifndef __sgi
+static
+#endif
+inline FLAC__bool FLAC__bitwriter_write_raw_uint32_nocheck(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits)
 {
 	register unsigned left;
 
--- ./src/share/Makefile.in.save	Sun Mar 24 16:42:06 2019
+++ ./src/share/Makefile.in	Sun Mar 24 16:43:15 2019
@@ -456,7 +456,7 @@
 	utf8/utf8.c
 
 replaygain_analysis_libreplaygain_analysis_la_SOURCES = replaygain_analysis/replaygain_analysis.c
-replaygain_synthesis_libreplaygain_synthesis_la_CFLAGS = -I $(top_srcdir)/src/share/replaygain_synthesis/include
+replaygain_synthesis_libreplaygain_synthesis_la_CFLAGS = -I$(top_srcdir)/src/share/replaygain_synthesis/include
 replaygain_synthesis_libreplaygain_synthesis_la_SOURCES = replaygain_synthesis/replaygain_synthesis.c
 all: all-am
 
--- ./test/test_grabbag.sh.save	Sun Mar 24 18:20:14 2019
+++ ./test/test_grabbag.sh	Sun Mar 24 18:20:21 2019
@@ -112,7 +112,7 @@
 	elif [ "$exit_code" != 0 ] ; then
 		die "Error: good cuesheet is broken"
 	fi
-	cuesheet_out=$(echo $cuesheet | sed "s|${top_srcdir}/test/||")
+	cuesheet_out=`echo $cuesheet | sed "s|${top_srcdir}/test/||"`
 	cuesheet_pass1=${cuesheet_out}.1
 	cuesheet_pass2=${cuesheet_out}.2
 	diff $cuesheet_pass1 $cuesheet_pass2 >> $log 2>&1 || die "Error: pass1 and pass2 output differ"
--- ./configure.save	Sun Mar 24 16:15:55 2019
+++ ./configure	Sun Mar 24 16:16:35 2019
@@ -20547,8 +20547,8 @@
 	CFLAGS="-g $CFLAGS"
 else
 	CPPFLAGS="-DNDEBUG $CPPFLAGS"
-	CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//')
-	CFLAGS="-O3 -funroll-loops $CFLAGS"
+#	CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//')
+#	CFLAGS="-O3 -funroll-loops $CFLAGS"
 fi
 
 
