libhfuzz: simplify memory cmps
diff --git a/libhfuzz/memorycmp.c b/libhfuzz/memorycmp.c
index f518f93..7121831 100644
--- a/libhfuzz/memorycmp.c
+++ b/libhfuzz/memorycmp.c
@@ -14,48 +14,36 @@
 #define RET_CALL_CHAIN (uintptr_t) __builtin_return_address(0)
 
 static inline int HF_strcmp(const char* s1, const char* s2, uintptr_t addr) {
-    unsigned int v = 0;
-
     size_t i;
     for (i = 0; s1[i] == s2[i]; i++) {
         if (s1[i] == '\0' || s2[i] == '\0') {
+            instrumentUpdateCmpMap(addr, i);
             break;
         }
-        v++;
     }
-    instrumentUpdateCmpMap(addr, v);
     return ((unsigned char)s1[i] - (unsigned char)s2[i]);
 }
 
 static inline int HF_strcasecmp(const char* s1, const char* s2, uintptr_t addr) {
-    unsigned int v = 0;
-
     size_t i;
     for (i = 0; tolower((unsigned char)s1[i]) == tolower((unsigned char)s2[i]); i++) {
         if (s1[i] == '\0' || s2[i] == '\0') {
+            instrumentUpdateCmpMap(addr, i);
             break;
         }
-        v++;
     }
-    instrumentUpdateCmpMap(addr, v);
     return (tolower((unsigned char)s1[i]) - tolower((unsigned char)s2[i]));
 }
 
 static inline int HF_strncmp(const char* s1, const char* s2, size_t n, uintptr_t addr) {
-    unsigned int v = 0;
-
     size_t i;
     for (i = 0; i < n; i++) {
-        if (s1[i] != s2[i]) {
+        if ((s1[i] != s2[i]) || s1[i] == '\0' || s2[i] == '\0') {
+            instrumentUpdateCmpMap(addr, i);
             break;
         }
-        if (s1[i] == '\0' || s2[i] == '\0') {
-            break;
-        }
-        v++;
     }
 
-    instrumentUpdateCmpMap(addr, v);
     if (i == n) {
         return 0;
     }
@@ -63,20 +51,15 @@
 }
 
 static inline int HF_strncasecmp(const char* s1, const char* s2, size_t n, uintptr_t addr) {
-    unsigned int v = 0;
-
     size_t i;
     for (i = 0; i < n; i++) {
-        if (tolower((unsigned char)s1[i]) != tolower((unsigned char)s2[i])) {
+        if ((tolower((unsigned char)s1[i]) != tolower((unsigned char)s2[i])) || s1[i] == '\0' ||
+            s2[i] == '\0') {
+            instrumentUpdateCmpMap(addr, i);
             break;
         }
-        if (s1[i] == '\0' || s2[i] == '\0') {
-            break;
-        }
-        v++;
     }
 
-    instrumentUpdateCmpMap(addr, v);
     if (i == n) {
         return 0;
     }
@@ -109,26 +92,21 @@
 }
 
 static inline int HF_memcmp(const void* m1, const void* m2, size_t n, uintptr_t addr) {
-    if (n == 0) {
-        return 0;
-    }
-
-    unsigned int v = 0;
-    int ret = 0;
-
     const unsigned char* s1 = (const unsigned char*)m1;
     const unsigned char* s2 = (const unsigned char*)m2;
 
-    for (size_t i = 0; i < n; i++) {
+    size_t i;
+    for (i = 0; i < n; i++) {
         if (s1[i] != s2[i]) {
-            ret = ret ? ret : (s1[i] - s2[i]);
-        } else {
-            v++;
+            instrumentUpdateCmpMap(addr, i);
+            break;
         }
     }
+    if (i == n) {
+        return 0;
+    }
 
-    instrumentUpdateCmpMap(addr, v);
-    return ret;
+    return ((unsigned char)s1[i] - (unsigned char)s2[i]);
 }
 
 static inline void* HF_memmem(const void* haystack, size_t haystacklen, const void* needle,