Native Decompiler Comparisons GHIDRA/JEB


Last updated on February 2021

This page shows various raw decompilation comparisons between GHIDRA 9 and JEB 4 (Beta). We chose the NSA's GHIDRA as the primary comparison point for native decompilation because it is a popular, high-quality tool that sets the highest standard in terms of native code decompilation for x86 and arm.

Expand for details
  • The long-term goal of this page is to constitute a large and representative sample set of decompilation outputs.
  • Decompilation is done using standard (default) settings. No renaming or refactoring of any kind is made, i.e. the output is the one that users would get without tweaking the settings or making use of custom plugins.
  • The binary files should be available and linked for download. If the binary cannot be made available for some reason we will try to provide the disassembly snippets, as well as, if possible, relevant hash(es).
  • The comparisons below are mostly for x86, x64, arm, and arm64. Both GHIDRA and JEB decompile many more architectures. However, that set of native processor types overlaps both products, and it represents the majority of native decompilation use-cases.
  • Decompilation is not everything GHIDRA and JEB can do, far from it. Other product features, such as general UX, API capabilities, other decompilers, non-decompiler modules (e.g. debuggers), etc. do not fall within the scope of this comparison page
  • JEB Community Edition is free; it includes all x86/x64 modules. Other modules, in a more limited version, are also available in the demo build.


Sample:

Min line: Max line: Include: Exclude:
[Reset]

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(1) arm | routine: 0x10A8C (68236) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
bad ident of func 1646c, missing parameters derived from the routine parameters; related to unused stack vars proper ident of 1646c
undefined4 FUN_00010a8c(void)

{
  undefined4 uVar1;
  uint in_stack_00000008;
  uint in_stack_0000000c;
  
  if ((in_stack_0000000c & 0x80000000 | in_stack_00000008 & 0xfff) != 0) {
    *(undefined4 *)(DAT_00010acc + 0x10aac) = 0x16;
    return 0xffffffff;
  }
  uVar1 = FUN_0001646c();
  return uVar1;
}
int sub_10A8C(int param0, int param1, int param2, int param3, int param4, int param5, int param6, int param7) {
    int v0;

    if(((param6 & 0xfff) | (param7 & 0x80000000)) != 0) {
        gvar_1A1F4 = 22;
        return -1;
    }

    return sub_1646C(param0, param1, param2, param3, param4, (param7 * 0x100000) | (param6 >>> 12), v0);
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(2) arm | routine: 0x10B44 (68420) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
inequality not simplified (SCARRY); sub-optimal structuring; return problem (CONCAT44) N/A
undefined8 FUN_00010b44(undefined4 param_1,undefined4 param_2)

{
  undefined4 extraout_r1;
  undefined4 extraout_r1_00;
  undefined4 extraout_r1_01;
  int iVar1;
  int iVar2;
  uint uVar3;
  uint uVar4;
  uint local_68 [3];
  int local_5c;
  undefined auStack88 [16];
  undefined auStack72 [16];
  undefined auStack56 [16];
  int local_28;
  
  local_28 = **(int **)(DAT_00010c38 + 0x10b5c);
  FUN_00010c40(auStack56,auStack72,auStack88,local_68);
  FUN_00010cf4(auStack56,extraout_r1,param_1,param_2);
  FUN_00010cf4(auStack72,extraout_r1_00,0xd1479563,0x4c34f55a);
  FUN_00010cf4(auStack88,extraout_r1_01,0x868df4e1,0xa9bf8e58);
  FUN_00010d8c(auStack56,auStack72,auStack88,local_68);
  if (local_68[0] == 0) {
    uVar3 = 0;
  }
  else {
    iVar1 = 2;
    if ((int)local_68[0] < 3) {
      iVar1 = local_68[0] - 1;
    }
    uVar3 = *(uint *)(local_5c + iVar1 * 4);
    if (0 < iVar1) {
      local_68[0] = ~local_68[0];
      if (local_68[0] == 0xfffffffc || (int)(local_68[0] + 4) < 0 != SCARRY4(local_68[0],4)) {
        local_68[0] = 0xfffffffc;
      }
      iVar1 = -3 - local_68[0];
      uVar4 = 0;
      do {
        uVar4 = uVar4 << 0x1c | uVar3 >> 4;
        uVar3 = *(uint *)(local_5c + iVar1 * 4) | uVar3 << 0x1c;
        iVar2 = iVar1 + 1;
        iVar1 = iVar1 + -1;
      } while (1 < iVar2);
      goto LAB_00010c06;
    }
  }
  uVar4 = 0;
LAB_00010c06:
  FUN_00010f44(auStack56,auStack72,auStack88,local_68);
  if (**(int **)(DAT_00010c3c + 0x10c1e) == local_28) {
    return CONCAT44(uVar4,uVar3);
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}
int sub_10B44(int param0, int param1) {
    int v0, result;
    char v1, v2, v3;
    int v4, v5;
    int* ptr0;
    int v6, v7;
    int* ptr1, ptr2, ptr3 = ptr1, ptr4 = ptr0, ptr5 = ptr2;
    int v8 = v6, v9 = 0;

    sub_10C40((int)&v1, (int)&v2, (int)&v3, (int)&v4);
    sub_10CF4((int)&v1, v5, param0, v5);
    sub_10CF4((int)&v2, v5, -783837853, 0x4c34f55a);
    sub_10CF4((int)&v3, v5, -2037517087, -1447063976);
    sub_10D8C((int)&v1, (int)&v2, (int)&v3, (int)&v4);
    if(v4 != 0) {
        result = *(int*)((v4 >= 3 ? 2: v4 - 1) * 4 + v7);
        if((v4 >= 3 ? 2: v4 - 1) >= 1) {
            int v10 = ~v4;
            if(v10 + 4 <= 0) {
                v10 = -4;
            }
            int v11 = -3 - v10;
            int v12 = 0;
            do {
                v12 = (v12 * 0x10000000) | (result >>> 4);
                result = (result * 0x10000000) | *(int*)(v11 * 4 + v7);
                v0 = v11 + 1;
                --v11;
            }
            while(v0 > 1);
        }
    }
    else {
        result = 0;
    }

    sub_10F44((int)&v1, (int)&v2, (int)&v3, (int)&v4);
    return result;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(3) arm | routine: 0x10C40 (68672) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
structured differently (2 nested loops vs 2 separate loops)
N/A cleaned the stack canary;
undefined4
FUN_00010c40(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  int iVar1;
  void *pvVar2;
  undefined4 uVar3;
  undefined4 *puVar4;
  int iVar5;
  int iVar6;
  bool bVar7;
  undefined4 *local_38;
  undefined4 *local_34;
  undefined4 local_c;
  undefined4 local_8;
  undefined4 uStack4;
  
  iVar1 = **(int **)(DAT_00010cec + 0x10c5c);
  local_c = param_2;
  local_8 = param_3;
  uStack4 = param_4;
  if (param_1 == (undefined4 *)0x0) {
    uVar3 = 0;
  }
  else {
    iVar6 = -1;
    puVar4 = param_1;
    local_34 = &local_c;
    do {
      pvVar2 = malloc(0x80);
      puVar4[3] = pvVar2;
      if (pvVar2 == (void *)0x0) {
        if (iVar6 != -1) {
          iVar5 = 0;
          local_38 = &local_c;
          do {
            FUN_00010fa0(param_1);
            bVar7 = iVar5 != iVar6;
            param_1 = (undefined4 *)*local_38;
            iVar5 = iVar5 + 1;
            local_38 = local_38 + 1;
          } while (bVar7);
        }
        uVar3 = 0xfffffffe;
        break;
      }
      __aeabi_memclr4(pvVar2,0x80);
      uVar3 = 0;
      iVar6 = iVar6 + 1;
      *puVar4 = 0;
      puVar4[1] = 0x20;
      puVar4[2] = 0;
      puVar4 = (undefined4 *)*local_34;
      local_34 = local_34 + 1;
    } while (puVar4 != (undefined4 *)0x0);
  }
  if (**(int **)(DAT_00010cf0 + 0x10cd2) == iVar1) {
    return uVar3;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}
int sub_10C40(int* param0, int param1, int param2, int param3) {
    char v0;
    int v1, v2;
    unsigned int* ptr0, ptr1 = ptr0;
    int v3 = v1, v4 = v2;
    int* ptr2 = param0;
    int v5 = param2, v6 = param3, v7 = param1;
    unsigned int* ptr3 = &v7;

    if(ptr2 != 0) {
        int v8 = -1;
        int* ptr4 = ptr2;
        while(1) {
            void* dest = →malloc(128);
            *(void**)(ptr4 + 3) = dest;
            if(dest == 0) {
                break;
            }
            else {
                →__aeabi_memclr4(dest, 128);
                ++v8;
                *ptr4 = 0;
                *(ptr4 + 1) = 32;
                *(ptr4 + 2) = 0;
                unsigned int* ptr5 = ptr3;
                ptr3 = ptr5 + 1;
                ptr4 = *ptr5;
                if(ptr4 == 0) {
                    return result;
                }
            }
        }
        unsigned int* ptr6 = &v7;
        if(v8 != -1) {
            ptr4 = NULL;
            do {
                sub_10FA0((int)ptr2);
                unsigned int* ptr7 = ptr6;
                v0 = ptr4 == v8;
                ptr6 = ptr7 + 1;
                ptr2 = *ptr7;
                ptr4 = (int*)((char*)ptr4 + 1);
            }
            while(v0 == 0);
        }
    }

    return result;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(4) arm | routine: 0x10CF4 (68852) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
void FUN_00010cf4(int *param_1,undefined4 param_2,uint param_3,uint param_4)

{
  uint *puVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  
  *param_1 = 0;
  param_1[2] = 0;
  if (0 < param_1[1]) {
    iVar2 = param_1[3];
    iVar3 = 0;
    do {
      *(undefined4 *)(iVar2 + iVar3 * 4) = 0;
      iVar3 = iVar3 + 1;
    } while (iVar3 < param_1[1]);
  }
  uVar4 = 0;
  do {
    iVar2 = FUN_000123ca(param_1,4,param_1);
    if (iVar2 != 0) {
      return;
    }
    puVar1 = (uint *)param_1[3];
    uVar4 = uVar4 + 1;
    *puVar1 = *puVar1 | param_4 >> 0x1c;
    iVar2 = *param_1;
    param_4 = param_4 << 4 | param_3 >> 0x1c;
    param_3 = param_3 << 4;
    iVar3 = iVar2 + 1;
    *param_1 = iVar3;
  } while (uVar4 < 0x10);
  if (-1 < iVar2) {
    do {
      iVar3 = iVar2;
      if (puVar1[iVar3] != 0) {
        iVar3 = iVar3 + 1;
        break;
      }
      *param_1 = iVar3;
      iVar2 = iVar3 + -1;
    } while (1 < iVar3 + 1);
  }
  if (iVar3 == 0) {
    param_1[2] = 0;
  }
  return;
}
int sub_10CF4(int* param0, int param1, int param2, int param3) {
    int v0, v1;
    int* ptr0;
    int result;

    *param0 = 0;
    int v2 = param3;
    *(param0 + 2) = 0;
    int v3 = param2;
    if(*(param0 + 1) >= 1) {
        int v4 = *(param0 + 3);
        int v5 = 0;
        do {
            *(int*)(v5 * 4 + v4) = 0;
            ++v5;
            param3 = *(param0 + 1);
        }
        while(v5 < param3);
    }

    unsigned int v6 = 0;
    do {
        result = sub_123CA((int)param0, 4, (int)param0, param3);
        if(result != 0) {
            return result;
        }
        ptr0 = *(unsigned int*)(param0 + 3);
        ++v6;
        param3 = v2 * 16;
        *ptr0 = (v2 >>> 28) | *ptr0;
        v1 = *param0;
        v2 = (v3 >>> 28) | param3;
        v3 *= 16;
        v0 = v1 + 1;
        *param0 = v1 + 1;
    }
    while(v6 < 16);

    if(v1 >= 0) {
        while(*(int*)(v1 * 4 + (int)ptr0) == 0) {
            int v7 = v1 - 1;
            *param0 = v1;
            int v8 = v1 + 1;
            v1 = v7;
            if(v8 <= 1) {
                v0 = v7 + 1;
                goto loc_10D7C;
            }
        }
        v0 = v1 + 1;
    }

loc_10D7C:
    result = 0;
    if(v0 == 0) {
        *(param0 + 2) = 0;
    }

    return result;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(5) arm | routine: 0x10F44 (69444) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
function at 10FA0 misidentified N/A
void FUN_00010f44(int param_1,int param_2,undefined4 param_3,undefined4 param_4)

{
  int iVar1;
  int *local_1c;
  int local_c;
  undefined4 local_8;
  undefined4 uStack4;
  
  iVar1 = **(int **)(DAT_00010f98 + 0x10f58);
  local_1c = &local_c;
  local_c = param_2;
  local_8 = param_3;
  uStack4 = param_4;
  while (param_1 != 0) {
    FUN_00010fa0();
    param_1 = *local_1c;
    local_1c = local_1c + 1;
  }
  if (**(int **)(DAT_00010f9c + 0x10f82) != iVar1) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
}
int sub_10F44(int param0, int param1, int param2, int param3) {
    int v0 = param2, v1 = param3, v2 = param1;
    int* ptr0 = &v2;

    while(param0 != 0) {
        sub_10FA0(param0);
        int* ptr1 = ptr0;
        ptr0 = ptr1 + 1;
        param0 = *ptr1;
    }

    return 0;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(6) arm | routine: 0x10FA0 (69536) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
void FUN_00010fa0(int *param_1)

{
  void *__ptr;
  int iVar1;
  
  __ptr = (void *)param_1[3];
  if (__ptr != (void *)0x0) {
    if (0 < *param_1) {
      iVar1 = 0;
      do {
        *(undefined4 *)((int)__ptr + iVar1 * 4) = 0;
        iVar1 = iVar1 + 1;
      } while (iVar1 < *param_1);
    }
    free(__ptr);
    *param_1 = 0;
    param_1[1] = 0;
    param_1[2] = 0;
    param_1[3] = 0;
  }
  return;
}
void* sub_10FA0(int* param0) {
    void* __ptr = *(void**)(param0 + 3);

    if(__ptr != 0) {
        if(*param0 >= 1) {
            int v0 = 0;
            do {
                *(int*)(v0 * 4 + (int)__ptr) = 0;
                ++v0;
            }
            while(*param0 > v0);
        }
        →free(__ptr);
        *param0 = 0;
        *(param0 + 1) = 0;
        *(param0 + 2) = 0;
        *(param0 + 3) = 0;
    }

    return 0;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(7) arm | routine: 0x10FD0 (69584) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
undefined4 FUN_00010fd0(undefined4 *param_1)

{
  void *pvVar1;
  
  pvVar1 = malloc(0x80);
  param_1[3] = pvVar1;
  if (pvVar1 != (void *)0x0) {
    __aeabi_memclr4(pvVar1,0x80);
    *param_1 = 0;
    param_1[1] = 0x20;
    param_1[2] = 0;
    return 0;
  }
  return 0xfffffffe;
}
int sub_10FD0(int* param0) {
    void* dest = →malloc(128);

    *(void**)(param0 + 3) = dest;
    if(dest != 0) {
        →__aeabi_memclr4(dest, 128);
        *param0 = 0;
        *(param0 + 1) = 32;
        *(param0 + 2) = 0;
        return 0;
    }

    return -2;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(8) arm | routine: 0x1100E (69646) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
N/A sub_11918 recognized as having 4 params, may be 2
void FUN_0001100e(int param_1,int param_2)

{
  int iVar1;
  
  if ((param_1 != param_2) && (iVar1 = FUN_00011918(param_1,param_2), iVar1 != 0)) {
    return;
  }
  *(undefined4 *)(param_2 + 8) = 0;
  return;
}
int sub_1100E(int param0, int param1, int param2, int param3) {
    if(param0 != param1) {
        int result = sub_11918(param0, param1, param2, param3);
        if(result != 0) {
            return result;
        }
    }

    *(int*)(param1 + 8) = 0;
    return param0;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(9) arm | routine: 0x11858 (71768) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
int FUN_00011858(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  int iVar1;
  int iVar2;
  int local_30;
  undefined4 local_2c;
  undefined4 local_28;
  void *local_24;
  int local_1c;
  
  local_1c = **(int **)(DAT_00011910 + 0x1186e);
  local_24 = malloc(0x80);
  if (local_24 == (void *)0x0) {
    iVar1 = -2;
  }
  else {
    __aeabi_memclr4(local_24,0x80);
    local_2c = 0x20;
    local_30 = 0;
    local_28 = 0;
    iVar1 = FUN_000119a2(param_1,param_2,&local_30);
    if (iVar1 == 0) {
      iVar1 = FUN_00011d64(&local_30,param_3,param_4);
      if (local_24 == (void *)0x0) goto LAB_000118f4;
      if (0 < local_30) {
        iVar2 = 0;
        do {
          *(undefined4 *)((int)local_24 + iVar2 * 4) = 0;
          iVar2 = iVar2 + 1;
        } while (iVar2 < local_30);
      }
    }
    else {
      if (local_24 == (void *)0x0) goto LAB_000118f4;
      if (0 < local_30) {
        iVar2 = 0;
        do {
          *(undefined4 *)((int)local_24 + iVar2 * 4) = 0;
          iVar2 = iVar2 + 1;
        } while (iVar2 < local_30);
      }
    }
    free(local_24);
    local_24 = (void *)0x0;
    local_28 = 0;
    local_2c = 0;
    local_30 = 0;
  }
LAB_000118f4:
  if (**(int **)(DAT_00011914 + 0x118fc) == local_1c) {
    return iVar1;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}
int sub_11858(int param0, int param1, int param2, int param3) {
    void* __ptr;
    int result, v0, v1, v2, v3, v4, v5 = v2;
    void* dest = →malloc(128);
    void* ptr0 = dest;

    if(dest != 0) {
        →__aeabi_memclr4(dest, 128);
        int v6 = 32, v7 = 0, v8 = 0;
        result = sub_119A2(v1, v3, (int)&v7);
        if(result != 0) {
            __ptr = ptr0;
            if(__ptr != 0) {
                if(v7 >= 1) {
                    int v9 = 0;
                    do {
                        *(int*)(v9 * 4 + (int)__ptr) = 0;
                        ++v9;
                    }
                    while(v9 < v7);
                }
                goto loc_118E6;
            }
        }
        else {
            result = sub_11D64((int)&v7, v0, v4, v4);
            __ptr = ptr0;
            if(__ptr != 0) {
                if(v7 >= 1) {
                    int v10 = 0;
                    do {
                        *(int*)(v10 * 4 + (int)__ptr) = 0;
                        ++v10;
                    }
                    while(v10 < v7);
                }
            loc_118E6:
                →free(__ptr);
            }
        }
    }
    else {
        result = -2;
    }

    return result;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(10) arm | routine: 0x11918 (71960) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
int FUN_00011918(int *param_1,int *param_2)

{
  undefined4 *puVar1;
  undefined4 *puVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  
  if (param_1 != param_2) {
    iVar3 = *param_1;
    if (param_2[1] < iVar3) {
      iVar3 = FUN_00011b70(param_2);
      if (iVar3 != 0) {
        return iVar3;
      }
      iVar3 = *param_1;
    }
    puVar1 = (undefined4 *)param_2[3];
    if (iVar3 < 1) {
      iVar4 = 0;
    }
    else {
      iVar5 = param_1[3];
      iVar4 = 0;
      puVar2 = puVar1;
      do {
        iVar3 = iVar4 * 4;
        iVar4 = iVar4 + 1;
        puVar1 = puVar2 + 1;
        *puVar2 = *(undefined4 *)(iVar5 + iVar3);
        iVar3 = *param_1;
        puVar2 = puVar1;
      } while (iVar4 < iVar3);
    }
    if (iVar4 < *param_2) {
      do {
        *puVar1 = 0;
        iVar4 = iVar4 + 1;
        puVar1 = puVar1 + 1;
      } while (iVar4 < *param_2);
      iVar3 = *param_1;
    }
    *param_2 = iVar3;
    param_2[2] = param_1[2];
  }
  return 0;
}
int sub_11918(int* param0, int* param1, int param2, int param3) {
    int* ptr0 = param1;

    if(param0 != ptr0) {
        param1 = *param0;
        if(*(ptr0 + 1) < (int)param1) {
            int result = sub_11B70((int)ptr0, (int)param1, param2, param3);
            if(result != 0) {
                return result;
            }
            param1 = *param0;
        }
        int* ptr1 = *(unsigned int*)(ptr0 + 3);
        if((int)param1 >= 1) {
            int v0 = *(param0 + 3);
            param2 = 0;
            do {
                int v1 = *(int*)(param2 * 4 + v0);
                ++param2;
                *ptr1 = v1;
                ++ptr1;
                param1 = *param0;
            }
            while((int)param1 > param2);
        }
        else {
            param2 = 0;
        }
        if(*ptr0 > param2) {
            do {
                *ptr1 = 0;
                ++ptr1;
                ++param2;
            }
            while(*ptr0 > param2);
            param1 = *param0;
        }
        *ptr0 = param1;
        *(ptr0 + 2) = *(param0 + 2);
    }

    return (int)param0;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(11) arm | routine: 0x119FC (72188) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
void FUN_000119fc(undefined4 *param_1,undefined4 *param_2)

{
  int iVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  undefined4 uVar4;
  undefined4 uVar5;
  undefined4 uVar6;
  undefined4 uVar7;
  undefined4 uVar8;
  
  iVar1 = **(int **)(DAT_00011a44 + 0x11a10);
  uVar2 = *param_1;
  uVar3 = param_1[1];
  uVar5 = param_1[2];
  uVar7 = param_1[3];
  uVar4 = param_2[1];
  uVar6 = param_2[2];
  uVar8 = param_2[3];
  *param_1 = *param_2;
  param_1[1] = uVar4;
  param_1[2] = uVar6;
  param_1[3] = uVar8;
  *param_2 = uVar2;
  param_2[1] = uVar3;
  param_2[2] = uVar5;
  param_2[3] = uVar7;
  if (**(int **)(DAT_00011a48 + 0x11a32) != iVar1) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
}
int sub_119FC(int* param0, int* param1) {
    int v0, v1 = v0;
    int v2 = *(param0 + 1);
    int v3 = *(param0 + 2);
    int v4 = *(param0 + 3);
    int v5 = *param0, v6 = v2, v7 = v3, v8 = v4;
    int v9 = *(param1 + 1);
    int v10 = *(param1 + 2);
    int v11 = *(param1 + 3);

    *param0 = *param1;
    *(param0 + 1) = v9;
    *(param0 + 2) = v10;
    *(param0 + 3) = v11;
    *param1 = v5;
    *(param1 + 1) = v6;
    *(param1 + 2) = v7;
    *(param1 + 3) = v8;
    return 0;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(12) arm | routine: 0x1288A (75914) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
incorrect decompilation e.g., "(iVar1 >> 4) - (iVar1 >> 0x1f);" should be "(iVar1 >> 4) + (iVar1 >> 0x1f);" N/A
int FUN_0001288a(int *param_1,uint param_2)

{
  int iVar1;
  int iVar2;
  
  *param_1 = 0;
  param_1[2] = 0;
  if (0 < param_1[1]) {
    iVar1 = param_1[3];
    iVar2 = 0;
    do {
      *(undefined4 *)(iVar1 + iVar2 * 4) = 0;
      iVar2 = iVar2 + 1;
    } while (iVar2 < param_1[1]);
  }
  iVar1 = (int)((longlong)(int)param_2 * -0x6db6db6d + ((ulonglong)param_2 << 0x20) >> 0x20);
  iVar2 = (iVar1 >> 4) - (iVar1 >> 0x1f);
  iVar1 = FUN_00011b70(param_1,iVar2 + 1);
  if (iVar1 == 0) {
    *param_1 = iVar2 + 1;
    *(int *)(param_1[3] + iVar2 * 4) = 1 << (param_2 + iVar2 * -0x1c & 0xff);
    iVar1 = 0;
  }
  return iVar1;
}
int sub_1288A(int param0, int param1) {
    int v0;
    int v1 = *(int*)(v0 + 4);

    *(int*)v0 = 0;
    *(int*)(v0 + 8) = 0;
    if(v1 >= 1) {
        int v2 = *(int*)(v0 + 12);
        int v3 = 0;
        do {
            *(int*)(v3 * 4 + v2) = 0;
            ++v3;
        }
        while(*(int*)(v0 + 4) > v3);
    }

    int v4 = sub_11B70(v0, param1 / 28 + 1);
    if(v4 == 0) {
        *(int*)v0 = param1 / 28 + 1;
        param0 = *(int*)(v0 + 12);
        *(int*)(param1 / 28 * 4 + param0) = 1 << (param1 - param1 / 28 * 28);
    }

    return param0;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(13) arm | routine: 0x135A0 (79264) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
N/A safe choice: sub 13EE8 identified with 2 params
undefined4 FUN_000135a0(undefined4 *param_1,undefined4 param_2)

{
  int iVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  
  uVar3 = *param_1;
  iVar1 = FUN_00013ee8(uVar3);
  uVar2 = 0;
  if ((iVar1 == 0) && (iVar1 = FUN_00013fa0(uVar3,param_1[1],param_1[5],param_2), iVar1 == 0)) {
    uVar2 = 1;
  }
  return uVar2;
}
int sub_135A0(int* param0, int param1) {
    int v0 = *param0;
    int v1 = sub_13EE8(v0, param1);
    int result = 0;

    if(v1 == 0) {
        int v2 = sub_13FA0(v0, *(param0 + 1), *(param0 + 5), param1);
        if(v2 == 0) {
            result = 1;
        }
    }

    return result;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(14) arm | routine: 0x13B18 (80664) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
undefined4 FUN_00013b18(byte *param_1,byte *param_2,int param_3,uint param_4)

{
  uint uVar1;
  undefined4 uVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  uint *puVar6;
  uint uVar7;
  uint uVar8;
  uint uStack56;
  byte *pbStack52;
  byte *pbStack48;
  int iStack44;
  
  iStack44 = **(int **)(DAT_00013c04 + 0x13b2e);
  puVar6 = (uint *)((int)&uStack56 - (param_4 * 4 + 7 & 0xfffffff8));
  if (param_4 != 0) {
    __aeabi_memclr4(puVar6,param_4 << 2);
  }
  if (param_1 < param_2) {
    uVar3 = 0;
    uStack56 = param_3 + 0x14;
    pbStack52 = param_2;
    do {
      uVar3 = (uVar3 & 0x1ffffff) << 5 ^ (uint)*param_1;
      pbStack48 = param_1 + 1;
      if (param_4 != 0) {
        uVar4 = 0;
        uVar1 = uStack56;
        do {
          iVar5 = param_3 + uVar4 * 0x28;
          uVar7 = *(uint *)(iVar5 + 4);
          if (uVar7 != 0) {
            uVar8 = 0;
            do {
              if (uVar3 == *(uint *)(uVar1 + uVar8 * 4)) {
                puVar6[uVar4] = puVar6[uVar4] | 1 << (uVar8 & 0xff);
              }
              uVar8 = uVar8 + 1;
            } while (uVar7 != uVar8);
          }
          if (puVar6[uVar4] == *(uint *)(iVar5 + 8)) {
            uVar2 = *(undefined4 *)(param_3 + uVar4 * 0x28);
            goto LAB_00013be4;
          }
          uVar4 = uVar4 + 1;
          uVar1 = uVar1 + 0x28;
        } while (uVar4 < param_4);
      }
      param_1 = pbStack48;
    } while (pbStack48 < pbStack52);
  }
  uVar2 = 0;
LAB_00013be4:
  if (**(int **)(DAT_00013c08 + 0x13bee) != iStack44) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return uVar2;
}
int sub_13B18(char* param0, unsigned int param1, int param2, unsigned int param3) {
    int result, v0, v1;
    unsigned int v2;
    int v3, v4, v5 = v3, v6 = v1, v7 = v4;
    unsigned int v8 = v2;
    char* ptr0 = param0;
    void* dest = (void*)((int)&v0 - ((param3 * 4 + 7) & 0xfffffff8));

    if(param3 != 0) {
        →__aeabi_memclr4(dest, (size_t)(param3 * 4));
    }

    if(param1 > (unsigned int)ptr0) {
        int v9 = 0;
        v0 = param2 + 20;
        unsigned int v10 = param1;
        do {
            v9 = ((v9 * 32) & 0x3fffffe0) ^ (unsigned int)*ptr0;
            char* ptr1 = ptr0 + 1;
            if(param3 != 0) {
                int v11 = v0;
                unsigned int v12 = 0;
                do {
                    v3 = v12 * 5;
                    int v13 = v3 * 8 + param2;
                    int v14 = *(int*)(v13 + 4);
                    if(v14 != 0) {
                        int v15 = 0;
                        do {
                            if(*(int*)(v15 * 4 + v11) == v9) {
                                *(int*)(v12 * 4 + (int)dest) = (1 << v15) | *(int*)(v12 * 4 + (int)dest);
                            }
                            ++v15;
                        }
                        while(v14 != v15);
                    }
                    if(*(int*)(v12 * 4 + (int)dest) != *(unsigned int*)(v13 + 8)) {
                        ++v12;
                        v11 += 40;
                    }
                    else {
                        return *(int*)(v3 * 8 + param2);
                    }
                }
                while(v12 < param3);
            }
            ptr0 = ptr1;
        }
        while((unsigned int)ptr0 < v10);
    }
    else {
        result = 0;
    }

    return result;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(15) arm | routine: 0x13C72 (81010) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
N/A optimized division by 12
int FUN_00013c72(undefined4 param_1,int param_2,undefined4 param_3,int param_4,uint param_5)

{
  int iVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  undefined4 *puVar4;
  uint uVar5;
  
  iVar1 = *(int *)(param_2 + 0x48);
  if (iVar1 != 0) {
    param_5 = (uint)((ulonglong)param_5 * 0xaaaaaaab >> 0x20);
  }
  if (param_5 >> 3 != 0) {
    puVar4 = (undefined4 *)(param_4 + 4);
    uVar5 = 0;
    while( true ) {
      if (iVar1 == 0) {
        uVar3 = *(undefined4 *)(param_4 + uVar5 * 8);
        uVar2 = *(undefined4 *)(param_4 + uVar5 * 8 + 4);
      }
      else {
        uVar3 = puVar4[-1];
        uVar2 = *puVar4;
      }
      iVar1 = FUN_00013ce8(param_3,uVar2,uVar3,param_2,param_1);
      if (iVar1 != 0) {
        return iVar1;
      }
      uVar5 = uVar5 + 1;
      if (param_5 >> 3 <= uVar5) break;
      iVar1 = *(int *)(param_2 + 0x48);
      puVar4 = puVar4 + 3;
    }
  }
  return 0;
}
int sub_13C72(int param0, int param1, int param2, int param3, unsigned int param4) {
    int result, v0, v1;
    int v2 = *(int*)(param1 + 72);
    unsigned int v3 = v2 != 0 ? param4 / 12: param4 >>> 3;

    if(v3 != 0) {
        int* ptr0 = (int*)(param3 + 4);
        unsigned int v4 = 0;
        while(1) {
            if(v2 != 0) {
                v1 = *(ptr0 - 1);
                v0 = *ptr0;
            }
            else {
                v1 = *(int*)(v4 * 8 + param3);
                v0 = *(int*)(v4 * 8 + param3 + 4);
            }
            result = sub_13CE8(param2, v0, v1, param1, param0);
            if(result != 0) {
                return result;
            }
            ++v4;
            if(v4 >= v3) {
                return 0;
            }
            v2 = *(int*)(param1 + 72);
            ptr0 += 3;
        }
    }
    else {
        result = 0;
    }

    return result;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(16) arm | routine: 0x13EE8 (81640) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
obfuscated control flow easier to read in JEB thanks to switch-in-loop recon instead of nested loops
undefined4 FUN_00013ee8(int *param_1,int param_2)

{
  byte bVar1;
  int iVar2;
  undefined4 uVar3;
  uint unaff_r5;
  int iVar4;
  undefined *puVar5;
  int local_30;
  undefined4 local_2c;
  
  if (*(char *)(DAT_00013f80 + 0x13efa) == '\0') {
    iVar2 = 0;
    iVar4 = DAT_00013f88 + 0x13f0c;
    puVar5 = (undefined *)(DAT_00013f84 + 0x13f12);
    while( true ) {
      while( true ) {
        while (iVar2 == 1) {
          bVar1 = *(byte *)(iVar4 + unaff_r5);
          iVar2 = local_30;
          FUN_000164f8(unaff_r5,param_2,local_30,local_2c);
          *(byte *)(iVar4 + unaff_r5) = (&UNK_00013f8c)[iVar2] ^ bVar1;
          unaff_r5 = unaff_r5 + 1;
          iVar2 = 2;
          if (unaff_r5 < 5) {
            iVar2 = 1;
          }
          param_2 = (int)unaff_r5 >> 0x1f;
        }
        if (iVar2 != 2) break;
        *puVar5 = 1;
        iVar2 = 3;
      }
      if (iVar2 == 3) break;
      unaff_r5 = 0;
      iVar2 = 1;
      local_30 = 0xc;
      local_2c = 0;
      param_2 = 0;
    }
  }
  if (*param_1 == *(int *)(DAT_00013f9c + 0x13f62)) {
    uVar3 = 0;
    if ((*(ushort *)(param_1 + 4) & 0xfffe) != 2) {
      uVar3 = 1;
    }
  }
  else {
    uVar3 = 1;
  }
  return uVar3;
}
int sub_13EE8(int* param0, int param1) {
    int v0, v1;
    unsigned int v2;
    int v3;
    unsigned int v4 = v2;

    if(gvar_1A1FC == 0) {
        int v5 = 0;
        while(1) {
            int v6 = v5 & 0x3;
            switch(v6) {
                case 1: {
                    int v7 = (unsigned int)*(char*)((int)&gvar_1A0D0 + v2);
                    sub_164F8((int)v2, param1, v1, v0);
                    *(char*)((int)&gvar_1A0D0 + v2) = (unsigned char)((unsigned int)aYVYF338TBFm0[v3] ^ v7);
                    ++v2;
                    v5 = v2 >= 5 ? 2: 1;
                    param1 = v2 >> 31;
                    break;
                }
                case 2: {
                    gvar_1A1FC = 1;
                    v5 = 3;
                    break;
                }
                case 3: {
                    break alab1;
                }
                default: {
                    v2 = 0;
                    v5 = 1;
                    v1 = 12;
                    v0 = 0;
                    param1 = 0;
                    break;
                }
            }
        }
    }

    return gvar_1A0D0 == *param0 ? ((unsigned int)*(short*)(param0 + 4) & 0xfffffffe) == 2 ? 0: 1: 1;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(17) arm | routine: 0x14214 (82452) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
int FUN_00014214(byte **param_1)

{
  byte bVar1;
  byte *pbVar2;
  int iVar3;
  char cVar4;
  byte *pbVar5;
  
  if (**param_1 == 0) {
    return 0;
  }
  iVar3 = 0;
  pbVar2 = *param_1;
  do {
    pbVar5 = pbVar2 + 1;
    *param_1 = pbVar5;
    bVar1 = *pbVar2;
    if (bVar1 < 0x30) {
      return iVar3;
    }
    if (0x66 < bVar1) {
      return iVar3;
    }
    if ((byte)(bVar1 - 0x3a) < 0x27) {
      return iVar3;
    }
    cVar4 = 'W';
    if (bVar1 < 0x3a) {
      cVar4 = '0';
    }
    iVar3 = iVar3 * 0x10 + (uint)(byte)(bVar1 - cVar4);
    pbVar2 = pbVar5;
  } while (*pbVar5 != 0);
  return iVar3;
}
int sub_14214(unsigned int* param0) {
    char* ptr0;
    unsigned int* ptr1 = param0;
    char* ptr2 = *ptr1;

    if(*ptr2 != 0) {
        char* ptr3 = ptr2 + 1;
        int result = 0;
        do {
            *ptr1 = ptr3;
            unsigned int v0 = (unsigned int)*(ptr3 - 1);
            if(v0 < 48 || v0 > 102) {
                return result;
            }
            else if((unsigned char)((unsigned char)v0 - 58) < 39) {
                return result;
            }
            ptr0 = ptr3;
            ++ptr3;
            result = result * 16 + (unsigned int)((v0 - (v0 >= 58 ? 87: 48)) & 0xFF);
        }
        while(*ptr0 != 0);
        return result;
    }

    return 0;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(18) arm | routine: 0x143F0 (82928) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
byte * FUN_000143f0(byte **param_1,uint param_2,byte *param_3)

{
  byte bVar1;
  byte *pbVar2;
  byte *pbVar3;
  
  pbVar2 = *param_1;
  *param_1 = pbVar2 + 1;
  bVar1 = *pbVar2;
  pbVar2 = param_3;
  while (bVar1 != param_2) {
    *pbVar2 = bVar1;
    pbVar3 = *param_1;
    *param_1 = pbVar3 + 1;
    bVar1 = *pbVar3;
    pbVar2 = pbVar2 + 1;
  }
  *pbVar2 = 0;
  return param_3;
}
char* sub_143F0(unsigned int* param0, int param1, char* param2) {
    char* ptr0 = *param0, ptr1 = param2;

    *param0 = (int*)(ptr0 + 1);
    int v0 = (unsigned int)*ptr0;
    if(param1 != v0) {
        ptr1 = param2;
        do {
            *ptr1 = (unsigned char)v0;
            ++ptr1;
            char* ptr2 = *param0;
            *param0 = (int*)(ptr2 + 1);
            v0 = (unsigned int)*ptr2;
        }
        while(param1 != v0);
    }

    *ptr1 = 0;
    return param2;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(19) arm | routine: 0x16408 (91144) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
N/A syscall reconstructed, proper error handling
void FUN_00016408(uint param_1)

{
  software_interrupt(0);
  if (param_1 < 0xfffff001) {
    return;
  }
                    /* WARNING: Could not recover jumptable at 0x00017584. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*(code *)((int)&DAT_00017588 + DAT_00017588))(-param_1);
  return;
}
int sub_16408(clockid_t param0, timespec* param1) {
    int result = sys_clock_gettime(param0, param1);  // syscall:clock_gettime

    if((unsigned int)result > 0xfffff000) {
        sub_1757C();
    }

    return result;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(20) arm | routine: 0x1642C (91180) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
N/A syscall reconstructed, proper error handling
void FUN_0001642c(uint param_1)

{
  software_interrupt(0);
  if (param_1 < 0xfffff001) {
    return;
  }
                    /* WARNING: Could not recover jumptable at 0x00017584. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*(code *)((int)&DAT_00017588 + DAT_00017588))(-param_1);
  return;
}
int sub_1642C(int param0) {
    int result = sys_close(param0);  // syscall:close

    if((unsigned int)result > 0xfffff000) {
        sub_1757C();
    }

    return result;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(21) arm | routine: 0x1644C (91212) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
void FUN_0001644c(uint param_1)

{
  software_interrupt(0);
  if (param_1 < 0xfffff001) {
    return;
  }
                    /* WARNING: Could not recover jumptable at 0x00017584. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*(code *)((int)&DAT_00017588 + DAT_00017588))(-param_1);
  return;
}
off_t sub_1644C(int param0, off_t param1, int param2) {
    off_t result = sys_lseek(param0, param1, param2);  // syscall:lseek

    if((unsigned int)result > 0xfffff000) {
        sub_1757C();
    }

    return result;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(22) arm | routine: 0x16494 (91284) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
void FUN_00016494(uint param_1)

{
  software_interrupt(0);
  if (param_1 < 0xfffff001) {
    return;
  }
                    /* WARNING: Could not recover jumptable at 0x00017584. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*(code *)((int)&DAT_00017588 + DAT_00017588))(-param_1);
  return;
}
int sub_16494(void* param0, size_t param1) {
    int result = sys_munmap(param0, param1);  // syscall:munmap

    if((unsigned int)result > 0xfffff000) {
        sub_1757C();
    }

    return result;
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(23) arm | routine: 0x165FE (91646) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
N/A reconstructed switch
undefined4 FUN_000165fe(int param_1)

{
  if (param_1 == 1) {
    return *(undefined4 *)(DAT_00016628 + 0x16616);
  }
  if (param_1 != 2) {
    if (param_1 == 0) {
      return *(undefined4 *)(DAT_00016624 + 0x1660e);
    }
    return 0;
  }
  return *(undefined4 *)(DAT_0001662c + 0x1661e);
}
unsigned int sub_165FE(int param0) {
    switch(param0) {
        case 0: {
            return gvar_19F70;
        }
        case 1: {
            return gvar_19F74;
        }
        case 2: {
            return gvar_19F78;
        }
        default: {
            return 0;
        }
    }
}

# GHIDRA-9.2.2

# JEB-4.0.1.202102182334.1

(24) arm | routine: 0x16990 (92560) | file: anonytun-10.2.apk%lib%armeabi-v7a%libd.so [BACKPORTED]
/* WARNING: Control flow encountered bad instruction data */

void FUN_00016990(void)

{
  int unaff_r4;
  bool in_ZR;
  undefined4 in_cr4;
  
  if (!in_ZR) {
    coprocessor_load(1,in_cr4,unaff_r4 + -0x3c0);
  }
                    /* WARNING: Bad instruction - Truncating control flow here */
  halt_baddata();
}
int sub_16990(int param0, int param1, int param2) {
    int result;
    char v0;
    int v1, v2, v3, v4, v5, v6, v7, v8;
    int v9 = *(int*)(param2 + 60);
    int v10 = v2, v11 = v3, v12 = v5, v13 = v7, v14 = v8, v15 = v6;

    *(int*)(param2 + 64) = v9;
    int v16 = *(int*)(param2 + 8);
    int v17 = *(int*)(param2 + 12);
    int v18 = *(int*)(param2 + 16);
    int v19 = *(int*)(param2 + 4);
    int v20 = v16, v21 = v17, v22 = v18;
    int v23 = *(int*)(param2 + 24);
    int v24 = *(int*)(param2 + 28);
    int v25 = *(int*)(param2 + 32);
    int v26 = *(int*)(param2 + 20);
    int v27 = v23, v28 = v24, v29 = v25;
    int v30 = *(int*)(param2 + 40);
    int v31 = *(int*)(param2 + 44);
    int v32 = *(int*)(param2 + 48);
    int v33 = *(int*)(param2 + 36);
    int v34 = v30, v35 = v31, v36 = v32;
    int v37 = *(int*)(param2 + 56);
    int v38 = *(int*)(param2 + 60);
    int* ptr0 = *(int**)(param2 + 64);
    int v39 = *(int*)(param2 + 52);
    int v40 = v37, v41 = v38;
    int* ptr1 = ptr0;
    int v42 = -1;
    for(int i = sub_16630(&v0, ptr1, v38); i == 0; i = sub_16630(&v0, ptr1, v38)) {
        sub_16976(&v42, 12, &v0);
        int v43 = param0(&v42, v4);
        if(v43 != 0) {
            break;
        }
        else {
            int v44 = v1(8, &v0, &v42);
            result = v44;
            if(v44 == 5) {
                sub_166D0((int*)&v42);
                return result;
            }
            else if(v44 == 9) {
                break;
            }
        }
    }

    result = 9;
    sub_166D0((int*)&v42);
    return result;
}

24 entries (will display at most 500 entries)