--- /dev/null
+#include <stdlib.h>
+
+typedef unsigned char uc;
+typedef unsigned __int128 uint128;
+
+void addvector(int *r, const int *a, const int *b, size_t len)
+{
+ for(int *r2 = r; r2 < r + len;r2++, a++, b++)
+ *r2 = *a + *b;
+}
+
+int memcmp(const void *s1, const void *s2, size_t n)
+{
+ for(uc *s3 = (uc*)s1, *s4 = (uc*)s2; s3 < (uc*)s1 + n; s3++, s4++)
+ if(*s3 != *s4)
+ return *s3-*s4;
+ return 0;
+}
+
+int memcmp_backwards(const void *s1, const void *s2, size_t n)
+{
+ for(uc *s3 = (uc*)s1+n, *s4 = (uc*)s2+n; s3 >= (uc*)s1; s3--, s4--)
+ if(*s3 != *s4)
+ return *s3-*s4;
+ return 0;
+}
+
+int memcmp_fast(const void *s1, const void *s2, size_t n)
+{
+ uint128 *s3 = (uint128 *)s1;
+ uint128 *s4 = (uint128 *)s2;
+ unsigned int blocks = n/sizeof(uint128);
+ for(; s3<((uint128*)s1)+blocks; s3++, s4++)
+ if(*s3 != *s4)
+ return memcmp(s3, s4, sizeof(uint128));
+ return memcmp(s3, s4, n % sizeof(uint128));
+}
--- /dev/null
+a) 0x7fffb3cc3b20
+ Location of the array
+
+b) 0x7fffb3cc3b24
+ Location of first element plus sizeof(4)
+
+c) 0x7fffb3cc3b30
+ Location of array plus sizeof(4*4)
+
+d) 25
+ Value of x[0]
+
+e) 28
+ Value of x[0] plus the value of x[2]
+
+f) 151
+ Value of x[0] plus the value of x[3]