diff --git a/include/assert.h b/include/assert.h
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..1a40206214bc81c7e103bbda7c2df8db6ff3c6e7 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -0,0 +1,14 @@
+#ifndef _ASSERT_H
+#define _ASSERT_H
+
+#ifdef NDEBUG
+# define assert(cond)
+#else
+# include <stdio.h>
+# define assert(cond) if (!(cond)) { \
+    fprintf(stderr, "%s: %s:%d: Assertion `%s` failed.\n", __func__, __FILE__, __LINE__, #cond); \
+    abort(); \
+    }
+#endif
+
+#endif
diff --git a/include/stddef.h b/include/stddef.h
index fa0bc7daf528f082aab9958c1054fa0f716e9a03..099ca1574be6a2712aae479a48b55f4140fff6db 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -3,10 +3,10 @@
 
 #define NULL 0
 
-typedef signed long long ptrdiff_t;
+typedef signed long ptrdiff_t;
 
 typedef unsigned char wchar_t;
 
-typedef unsigned long long size_t;
+typedef unsigned long size_t;
 
 #endif /* _STDDEF_H */
diff --git a/include/stdint.h b/include/stdint.h
index 8b787427af7b8c4b4dcde46bc5b64ab31ddb4143..cf25e00fbeba1675052d52d49dfcc0e696097ed6 100644
--- a/include/stdint.h
+++ b/include/stdint.h
@@ -56,54 +56,54 @@ typedef unsigned short uint_fast16_t;
 #define INT32_C(value) value ## L
 #define INT32_MIN -0x80000000
 #define INT32_MAX 0x7FFFFFFF
-typedef signed long int32_t;
+typedef signed int int32_t;
 
 #define INT_LEAST32_MIN -0x80000000
 #define INT_LEAST32_MAX 0x7FFFFFFF
-typedef signed long int_least32_t;
+typedef signed int int_least32_t;
 
 #define INT_FAST32_MIN -0x80000000
 #define INT_FAST32_MAX 0x7FFFFFFF
-typedef signed long int_fast32_t;
+typedef signed int int_fast32_t;
 
 #define UINT32_C(value) value ## UL
 #define UINT32_MIN 0x00000000
 #define UINT32_MAX 0xFFFFFFFF
-typedef unsigned long uint32_t;
+typedef unsigned int uint32_t;
 
 #define UINT_LEAST32_MIN 0x00000000
 #define UINT_LEAST32_MAX 0xFFFFFFFF
-typedef unsigned long uint_least32_t;
+typedef unsigned int uint_least32_t;
 
 #define UINT_FAST32_MIN 0x00000000
 #define UINT_FAST32_MAX 0xFFFFFFFF
-typedef unsigned long uint_fast32_t;
+typedef unsigned int uint_fast32_t;
 
 #define INT64_C(value) value ## LL
 #define INT64_MIN -0x8000000000000000
 #define INT64_MAX 0x7FFFFFFFFFFFFFFF
-typedef signed long long int64_t;
+typedef signed long int64_t;
 
 #define INT_LEAST64_MIN -0x8000000000000000
 #define INT_LEAST64_MAX 0x7FFFFFFFFFFFFFFF
-typedef signed long long int_least64_t;
+typedef signed long int_least64_t;
 
 #define INT_FAST64_MIN -0x8000000000000000
 #define INT_FAST64_MAX 0x7FFFFFFFFFFFFFFF
-typedef signed long long int_fast64_t;
+typedef signed long int_fast64_t;
 
 #define UINT64_C(value) value ## ULL
 #define UINT64_MIN 0x0000000000000000
 #define UINT64_MAX 0xFFFFFFFFFFFFFFFF
-typedef unsigned long long uint64_t;
+typedef unsigned long uint64_t;
 
 #define UINT_LEAST64_MIN 0x0000000000000000
 #define UINT_LEAST64_MAX 0xFFFFFFFFFFFFFFFF
-typedef unsigned long long uint_least64_t;
+typedef unsigned long uint_least64_t;
 
 #define UINT_FAST64_MIN 0x0000000000000000
 #define UINT_FAST64_MAX 0xFFFFFFFFFFFFFFFF
-typedef unsigned long long uint_fast64_t;
+typedef unsigned long uint_fast64_t;
 
 #define INTMAX_C(value) value ## LL
 #define INTMAX_MIN INT64_MIN
diff --git a/src/stdlib/src/lib.rs b/src/stdlib/src/lib.rs
index 8707ef5429e011d81bf04bcbd0ff7b67effa8d53..de4b44bac589791c06fb5329da0f690cdc99b4d6 100644
--- a/src/stdlib/src/lib.rs
+++ b/src/stdlib/src/lib.rs
@@ -620,7 +620,11 @@ macro_rules! strto_impl {
 
         let set_endptr = |idx: isize| {
             if !$endptr.is_null() {
-                *$endptr = $s.offset(idx);
+                // This is stupid, but apparently strto* functions want
+                // const input but mut output, yet the man page says
+                // "stores the address of the first invalid character in *endptr"
+                // so obviously it doesn't want us to clone it.
+                *$endptr = $s.offset(idx) as *mut _;
             }
         };
 
@@ -712,7 +716,7 @@ macro_rules! strto_impl {
 
 #[no_mangle]
 pub unsafe extern "C" fn strtoul(s: *const c_char,
-                                 endptr: *mut *const c_char,
+                                 endptr: *mut *mut c_char,
                                  base: c_int)
                                  -> c_ulong {
     strto_impl!(
@@ -728,7 +732,7 @@ pub unsafe extern "C" fn strtoul(s: *const c_char,
 
 #[no_mangle]
 pub unsafe extern "C" fn strtol(s: *const c_char,
-                                endptr: *mut *const c_char,
+                                endptr: *mut *mut c_char,
                                 base: c_int)
                                 -> c_long {
     strto_impl!(
diff --git a/tests/.gitignore b/tests/.gitignore
index 37a4bde5c495acab9729ed6c49de56e9ce6cef84..156ddf26072d63d1572a8f0b4b897b05185ad894 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,6 +1,7 @@
 /*.out
 /gen/
 /alloc
+/assert
 /args
 /atof
 /atoi
diff --git a/tests/Makefile b/tests/Makefile
index c15213a22ac0a6fadf6b6436c5e8056a83841093..c08209e3ec96853252e5e122f793c2136ee2a92e 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,5 +1,6 @@
 # Binaries that should generate the same output every time
 EXPECT_BINS=\
+	assert \
 	atof \
 	atoi \
 	brk \
diff --git a/tests/assert.c b/tests/assert.c
new file mode 100644
index 0000000000000000000000000000000000000000..320737f2f61a8f7c727d6f8036a19e0bc3d2c6ac
--- /dev/null
+++ b/tests/assert.c
@@ -0,0 +1,14 @@
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+int main() {
+    assert(1 == 1);
+    assert(1 + 1 == 2);
+
+    puts("yay!");
+
+    //This fails, but I can't test it because that'd
+    //make the test fail lol
+    //assert(42 == 1337);
+}
diff --git a/tests/expected/assert.stderr b/tests/expected/assert.stderr
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/tests/expected/assert.stdout b/tests/expected/assert.stdout
new file mode 100644
index 0000000000000000000000000000000000000000..3650d378d39e967450d22b79e2dd2774a6aae30f
--- /dev/null
+++ b/tests/expected/assert.stdout
@@ -0,0 +1 @@
+yay!