| 1 | /* Capstone Disassembly Engine */cxx . . $ `<file>/arch/WASM/WASMDisassembler.c`/ |
| 2 | /* By Spike, xwings 2019 */ |
| 3 | |
| 4 | #include <string.h> |
| 5 | #include <stddef.h> // offsetof macro |
| 6 | // alternatively #include "../../utils.h" like everyone else |
| 7 | |
| 8 | #include "WASMDisassembler.h"cxx . . $ `<file>/arch/WASM/WASMDisassembler.h`/ |
| 9 | #include "WASMMapping.h"cxx . . $ `<file>/arch/WASM/WASMMapping.h`/ |
| 10 | #include "../../cs_priv.h"cxx . . $ `<file>/cs_priv.h`/ |
| 11 | |
| 12 | static const short opcodescxx . . $ opcodes.[256] = { |
| 13 | WASM_INS_UNREACHABLEcxx . . $ WASM_INS_UNREACHABLE., |
| 14 | WASM_INS_NOPcxx . . $ WASM_INS_NOP., |
| 15 | WASM_INS_BLOCKcxx . . $ WASM_INS_BLOCK., |
| 16 | WASM_INS_LOOPcxx . . $ WASM_INS_LOOP., |
| 17 | WASM_INS_IFcxx . . $ WASM_INS_IF., |
| 18 | WASM_INS_ELSEcxx . . $ WASM_INS_ELSE., |
| 19 | -1, |
| 20 | -1, |
| 21 | -1, |
| 22 | -1, |
| 23 | -1, |
| 24 | WASM_INS_ENDcxx . . $ WASM_INS_END., |
| 25 | WASM_INS_BRcxx . . $ WASM_INS_BR., |
| 26 | WASM_INS_BR_IFcxx . . $ WASM_INS_BR_IF., |
| 27 | WASM_INS_BR_TABLEcxx . . $ WASM_INS_BR_TABLE., |
| 28 | WASM_INS_RETURNcxx . . $ WASM_INS_RETURN., |
| 29 | WASM_INS_CALLcxx . . $ WASM_INS_CALL., |
| 30 | WASM_INS_CALL_INDIRECTcxx . . $ WASM_INS_CALL_INDIRECT., |
| 31 | -1, |
| 32 | -1, |
| 33 | -1, |
| 34 | -1, |
| 35 | -1, |
| 36 | -1, |
| 37 | -1, |
| 38 | -1, |
| 39 | WASM_INS_DROPcxx . . $ WASM_INS_DROP., |
| 40 | WASM_INS_SELECTcxx . . $ WASM_INS_SELECT., |
| 41 | -1, |
| 42 | -1, |
| 43 | -1, |
| 44 | -1, |
| 45 | WASM_INS_GET_LOCALcxx . . $ WASM_INS_GET_LOCAL., |
| 46 | WASM_INS_SET_LOCALcxx . . $ WASM_INS_SET_LOCAL., |
| 47 | WASM_INS_TEE_LOCALcxx . . $ WASM_INS_TEE_LOCAL., |
| 48 | WASM_INS_GET_GLOBALcxx . . $ WASM_INS_GET_GLOBAL., |
| 49 | WASM_INS_SET_GLOBALcxx . . $ WASM_INS_SET_GLOBAL., |
| 50 | -1, |
| 51 | -1, |
| 52 | -1, |
| 53 | WASM_INS_I32_LOADcxx . . $ WASM_INS_I32_LOAD., |
| 54 | WASM_INS_I64_LOADcxx . . $ WASM_INS_I64_LOAD., |
| 55 | WASM_INS_F32_LOADcxx . . $ WASM_INS_F32_LOAD., |
| 56 | WASM_INS_F64_LOADcxx . . $ WASM_INS_F64_LOAD., |
| 57 | WASM_INS_I32_LOAD8_Scxx . . $ WASM_INS_I32_LOAD8_S., |
| 58 | WASM_INS_I32_LOAD8_Ucxx . . $ WASM_INS_I32_LOAD8_U., |
| 59 | WASM_INS_I32_LOAD16_Scxx . . $ WASM_INS_I32_LOAD16_S., |
| 60 | WASM_INS_I32_LOAD16_Ucxx . . $ WASM_INS_I32_LOAD16_U., |
| 61 | WASM_INS_I64_LOAD8_Scxx . . $ WASM_INS_I64_LOAD8_S., |
| 62 | WASM_INS_I64_LOAD8_Ucxx . . $ WASM_INS_I64_LOAD8_U., |
| 63 | WASM_INS_I64_LOAD16_Scxx . . $ WASM_INS_I64_LOAD16_S., |
| 64 | WASM_INS_I64_LOAD16_Ucxx . . $ WASM_INS_I64_LOAD16_U., |
| 65 | WASM_INS_I64_LOAD32_Scxx . . $ WASM_INS_I64_LOAD32_S., |
| 66 | WASM_INS_I64_LOAD32_Ucxx . . $ WASM_INS_I64_LOAD32_U., |
| 67 | WASM_INS_I32_STOREcxx . . $ WASM_INS_I32_STORE., |
| 68 | WASM_INS_I64_STOREcxx . . $ WASM_INS_I64_STORE., |
| 69 | WASM_INS_F32_STOREcxx . . $ WASM_INS_F32_STORE., |
| 70 | WASM_INS_F64_STOREcxx . . $ WASM_INS_F64_STORE., |
| 71 | WASM_INS_I32_STORE8cxx . . $ WASM_INS_I32_STORE8., |
| 72 | WASM_INS_I32_STORE16cxx . . $ WASM_INS_I32_STORE16., |
| 73 | WASM_INS_I64_STORE8cxx . . $ WASM_INS_I64_STORE8., |
| 74 | WASM_INS_I64_STORE16cxx . . $ WASM_INS_I64_STORE16., |
| 75 | WASM_INS_I64_STORE32cxx . . $ WASM_INS_I64_STORE32., |
| 76 | WASM_INS_CURRENT_MEMORYcxx . . $ WASM_INS_CURRENT_MEMORY., |
| 77 | WASM_INS_GROW_MEMORYcxx . . $ WASM_INS_GROW_MEMORY., |
| 78 | WASM_INS_I32_CONSTcxx . . $ WASM_INS_I32_CONST., |
| 79 | WASM_INS_I64_CONSTcxx . . $ WASM_INS_I64_CONST., |
| 80 | WASM_INS_F32_CONSTcxx . . $ WASM_INS_F32_CONST., |
| 81 | WASM_INS_F64_CONSTcxx . . $ WASM_INS_F64_CONST., |
| 82 | WASM_INS_I32_EQZcxx . . $ WASM_INS_I32_EQZ., |
| 83 | WASM_INS_I32_EQcxx . . $ WASM_INS_I32_EQ., |
| 84 | WASM_INS_I32_NEcxx . . $ WASM_INS_I32_NE., |
| 85 | WASM_INS_I32_LT_Scxx . . $ WASM_INS_I32_LT_S., |
| 86 | WASM_INS_I32_LT_Ucxx . . $ WASM_INS_I32_LT_U., |
| 87 | WASM_INS_I32_GT_Scxx . . $ WASM_INS_I32_GT_S., |
| 88 | WASM_INS_I32_GT_Ucxx . . $ WASM_INS_I32_GT_U., |
| 89 | WASM_INS_I32_LE_Scxx . . $ WASM_INS_I32_LE_S., |
| 90 | WASM_INS_I32_LE_Ucxx . . $ WASM_INS_I32_LE_U., |
| 91 | WASM_INS_I32_GE_Scxx . . $ WASM_INS_I32_GE_S., |
| 92 | WASM_INS_I32_GE_Ucxx . . $ WASM_INS_I32_GE_U., |
| 93 | WASM_INS_I64_EQZcxx . . $ WASM_INS_I64_EQZ., |
| 94 | WASM_INS_I64_EQcxx . . $ WASM_INS_I64_EQ., |
| 95 | WASM_INS_I64_NEcxx . . $ WASM_INS_I64_NE., |
| 96 | WASM_INS_I64_LT_Scxx . . $ WASM_INS_I64_LT_S., |
| 97 | WASM_INS_I64_LT_Ucxx . . $ WASM_INS_I64_LT_U., |
| 98 | WASN_INS_I64_GT_Scxx . . $ WASN_INS_I64_GT_S., |
| 99 | WASM_INS_I64_GT_Ucxx . . $ WASM_INS_I64_GT_U., |
| 100 | WASM_INS_I64_LE_Scxx . . $ WASM_INS_I64_LE_S., |
| 101 | WASM_INS_I64_LE_Ucxx . . $ WASM_INS_I64_LE_U., |
| 102 | WASM_INS_I64_GE_Scxx . . $ WASM_INS_I64_GE_S., |
| 103 | WASM_INS_I64_GE_Ucxx . . $ WASM_INS_I64_GE_U., |
| 104 | WASM_INS_F32_EQcxx . . $ WASM_INS_F32_EQ., |
| 105 | WASM_INS_F32_NEcxx . . $ WASM_INS_F32_NE., |
| 106 | WASM_INS_F32_LTcxx . . $ WASM_INS_F32_LT., |
| 107 | WASM_INS_F32_GTcxx . . $ WASM_INS_F32_GT., |
| 108 | WASM_INS_F32_LEcxx . . $ WASM_INS_F32_LE., |
| 109 | WASM_INS_F32_GEcxx . . $ WASM_INS_F32_GE., |
| 110 | WASM_INS_F64_EQcxx . . $ WASM_INS_F64_EQ., |
| 111 | WASM_INS_F64_NEcxx . . $ WASM_INS_F64_NE., |
| 112 | WASM_INS_F64_LTcxx . . $ WASM_INS_F64_LT., |
| 113 | WASM_INS_F64_GTcxx . . $ WASM_INS_F64_GT., |
| 114 | WASM_INS_F64_LEcxx . . $ WASM_INS_F64_LE., |
| 115 | WASM_INS_F64_GEcxx . . $ WASM_INS_F64_GE., |
| 116 | WASM_INS_I32_CLZcxx . . $ WASM_INS_I32_CLZ., |
| 117 | WASM_INS_I32_CTZcxx . . $ WASM_INS_I32_CTZ., |
| 118 | WASM_INS_I32_POPCNTcxx . . $ WASM_INS_I32_POPCNT., |
| 119 | WASM_INS_I32_ADDcxx . . $ WASM_INS_I32_ADD., |
| 120 | WASM_INS_I32_SUBcxx . . $ WASM_INS_I32_SUB., |
| 121 | WASM_INS_I32_MULcxx . . $ WASM_INS_I32_MUL., |
| 122 | WASM_INS_I32_DIV_Scxx . . $ WASM_INS_I32_DIV_S., |
| 123 | WASM_INS_I32_DIV_Ucxx . . $ WASM_INS_I32_DIV_U., |
| 124 | WASM_INS_I32_REM_Scxx . . $ WASM_INS_I32_REM_S., |
| 125 | WASM_INS_I32_REM_Ucxx . . $ WASM_INS_I32_REM_U., |
| 126 | WASM_INS_I32_ANDcxx . . $ WASM_INS_I32_AND., |
| 127 | WASM_INS_I32_ORcxx . . $ WASM_INS_I32_OR., |
| 128 | WASM_INS_I32_XORcxx . . $ WASM_INS_I32_XOR., |
| 129 | WASM_INS_I32_SHLcxx . . $ WASM_INS_I32_SHL., |
| 130 | WASM_INS_I32_SHR_Scxx . . $ WASM_INS_I32_SHR_S., |
| 131 | WASM_INS_I32_SHR_Ucxx . . $ WASM_INS_I32_SHR_U., |
| 132 | WASM_INS_I32_ROTLcxx . . $ WASM_INS_I32_ROTL., |
| 133 | WASM_INS_I32_ROTRcxx . . $ WASM_INS_I32_ROTR., |
| 134 | WASM_INS_I64_CLZcxx . . $ WASM_INS_I64_CLZ., |
| 135 | WASM_INS_I64_CTZcxx . . $ WASM_INS_I64_CTZ., |
| 136 | WASM_INS_I64_POPCNTcxx . . $ WASM_INS_I64_POPCNT., |
| 137 | WASM_INS_I64_ADDcxx . . $ WASM_INS_I64_ADD., |
| 138 | WASM_INS_I64_SUBcxx . . $ WASM_INS_I64_SUB., |
| 139 | WASM_INS_I64_MULcxx . . $ WASM_INS_I64_MUL., |
| 140 | WASM_INS_I64_DIV_Scxx . . $ WASM_INS_I64_DIV_S., |
| 141 | WASM_INS_I64_DIV_Ucxx . . $ WASM_INS_I64_DIV_U., |
| 142 | WASM_INS_I64_REM_Scxx . . $ WASM_INS_I64_REM_S., |
| 143 | WASM_INS_I64_REM_Ucxx . . $ WASM_INS_I64_REM_U., |
| 144 | WASM_INS_I64_ANDcxx . . $ WASM_INS_I64_AND., |
| 145 | WASM_INS_I64_ORcxx . . $ WASM_INS_I64_OR., |
| 146 | WASM_INS_I64_XORcxx . . $ WASM_INS_I64_XOR., |
| 147 | WASM_INS_I64_SHLcxx . . $ WASM_INS_I64_SHL., |
| 148 | WASM_INS_I64_SHR_Scxx . . $ WASM_INS_I64_SHR_S., |
| 149 | WASM_INS_I64_SHR_Ucxx . . $ WASM_INS_I64_SHR_U., |
| 150 | WASM_INS_I64_ROTLcxx . . $ WASM_INS_I64_ROTL., |
| 151 | WASM_INS_I64_ROTRcxx . . $ WASM_INS_I64_ROTR., |
| 152 | WASM_INS_F32_ABScxx . . $ WASM_INS_F32_ABS., |
| 153 | WASM_INS_F32_NEGcxx . . $ WASM_INS_F32_NEG., |
| 154 | WASM_INS_F32_CEILcxx . . $ WASM_INS_F32_CEIL., |
| 155 | WASM_INS_F32_FLOORcxx . . $ WASM_INS_F32_FLOOR., |
| 156 | WASM_INS_F32_TRUNCcxx . . $ WASM_INS_F32_TRUNC., |
| 157 | WASM_INS_F32_NEARESTcxx . . $ WASM_INS_F32_NEAREST., |
| 158 | WASM_INS_F32_SQRTcxx . . $ WASM_INS_F32_SQRT., |
| 159 | WASM_INS_F32_ADDcxx . . $ WASM_INS_F32_ADD., |
| 160 | WASM_INS_F32_SUBcxx . . $ WASM_INS_F32_SUB., |
| 161 | WASM_INS_F32_MULcxx . . $ WASM_INS_F32_MUL., |
| 162 | WASM_INS_F32_DIVcxx . . $ WASM_INS_F32_DIV., |
| 163 | WASM_INS_F32_MINcxx . . $ WASM_INS_F32_MIN., |
| 164 | WASM_INS_F32_MAXcxx . . $ WASM_INS_F32_MAX., |
| 165 | WASM_INS_F32_COPYSIGNcxx . . $ WASM_INS_F32_COPYSIGN., |
| 166 | WASM_INS_F64_ABScxx . . $ WASM_INS_F64_ABS., |
| 167 | WASM_INS_F64_NEGcxx . . $ WASM_INS_F64_NEG., |
| 168 | WASM_INS_F64_CEILcxx . . $ WASM_INS_F64_CEIL., |
| 169 | WASM_INS_F64_FLOORcxx . . $ WASM_INS_F64_FLOOR., |
| 170 | WASM_INS_F64_TRUNCcxx . . $ WASM_INS_F64_TRUNC., |
| 171 | WASM_INS_F64_NEARESTcxx . . $ WASM_INS_F64_NEAREST., |
| 172 | WASM_INS_F64_SQRTcxx . . $ WASM_INS_F64_SQRT., |
| 173 | WASM_INS_F64_ADDcxx . . $ WASM_INS_F64_ADD., |
| 174 | WASM_INS_F64_SUBcxx . . $ WASM_INS_F64_SUB., |
| 175 | WASM_INS_F64_MULcxx . . $ WASM_INS_F64_MUL., |
| 176 | WASM_INS_F64_DIVcxx . . $ WASM_INS_F64_DIV., |
| 177 | WASM_INS_F64_MINcxx . . $ WASM_INS_F64_MIN., |
| 178 | WASM_INS_F64_MAXcxx . . $ WASM_INS_F64_MAX., |
| 179 | WASM_INS_F64_COPYSIGNcxx . . $ WASM_INS_F64_COPYSIGN., |
| 180 | WASM_INS_I32_WARP_I64cxx . . $ WASM_INS_I32_WARP_I64., |
| 181 | WASP_INS_I32_TRUNC_S_F32cxx . . $ WASP_INS_I32_TRUNC_S_F32., |
| 182 | WASM_INS_I32_TRUNC_U_F32cxx . . $ WASM_INS_I32_TRUNC_U_F32., |
| 183 | WASM_INS_I32_TRUNC_S_F64cxx . . $ WASM_INS_I32_TRUNC_S_F64., |
| 184 | WASM_INS_I32_TRUNC_U_F64cxx . . $ WASM_INS_I32_TRUNC_U_F64., |
| 185 | WASM_INS_I64_EXTEND_S_I32cxx . . $ WASM_INS_I64_EXTEND_S_I32., |
| 186 | WASM_INS_I64_EXTEND_U_I32cxx . . $ WASM_INS_I64_EXTEND_U_I32., |
| 187 | WASM_INS_I64_TRUNC_S_F32cxx . . $ WASM_INS_I64_TRUNC_S_F32., |
| 188 | WASM_INS_I64_TRUNC_U_F32cxx . . $ WASM_INS_I64_TRUNC_U_F32., |
| 189 | WASM_INS_I64_TRUNC_S_F64cxx . . $ WASM_INS_I64_TRUNC_S_F64., |
| 190 | WASM_INS_I64_TRUNC_U_F64cxx . . $ WASM_INS_I64_TRUNC_U_F64., |
| 191 | WASM_INS_F32_CONVERT_S_I32cxx . . $ WASM_INS_F32_CONVERT_S_I32., |
| 192 | WASM_INS_F32_CONVERT_U_I32cxx . . $ WASM_INS_F32_CONVERT_U_I32., |
| 193 | WASM_INS_F32_CONVERT_S_I64cxx . . $ WASM_INS_F32_CONVERT_S_I64., |
| 194 | WASM_INS_F32_CONVERT_U_I64cxx . . $ WASM_INS_F32_CONVERT_U_I64., |
| 195 | WASM_INS_F32_DEMOTE_F64cxx . . $ WASM_INS_F32_DEMOTE_F64., |
| 196 | WASM_INS_F64_CONVERT_S_I32cxx . . $ WASM_INS_F64_CONVERT_S_I32., |
| 197 | WASM_INS_F64_CONVERT_U_I32cxx . . $ WASM_INS_F64_CONVERT_U_I32., |
| 198 | WASM_INS_F64_CONVERT_S_I64cxx . . $ WASM_INS_F64_CONVERT_S_I64., |
| 199 | WASM_INS_F64_CONVERT_U_I64cxx . . $ WASM_INS_F64_CONVERT_U_I64., |
| 200 | WASM_INS_F64_PROMOTE_F32cxx . . $ WASM_INS_F64_PROMOTE_F32., |
| 201 | WASM_INS_I32_REINTERPRET_F32cxx . . $ WASM_INS_I32_REINTERPRET_F32., |
| 202 | WASM_INS_I64_REINTERPRET_F64cxx . . $ WASM_INS_I64_REINTERPRET_F64., |
| 203 | WASM_INS_F32_REINTERPRET_I32cxx . . $ WASM_INS_F32_REINTERPRET_I32., |
| 204 | WASM_INS_F64_REINTERPRET_I64cxx . . $ WASM_INS_F64_REINTERPRET_I64., |
| 205 | -1, |
| 206 | -1, |
| 207 | -1, |
| 208 | -1, |
| 209 | -1, |
| 210 | -1, |
| 211 | -1, |
| 212 | -1, |
| 213 | -1, |
| 214 | -1, |
| 215 | -1, |
| 216 | -1, |
| 217 | -1, |
| 218 | -1, |
| 219 | -1, |
| 220 | -1, |
| 221 | -1, |
| 222 | -1, |
| 223 | -1, |
| 224 | -1, |
| 225 | -1, |
| 226 | -1, |
| 227 | -1, |
| 228 | -1, |
| 229 | -1, |
| 230 | -1, |
| 231 | -1, |
| 232 | -1, |
| 233 | -1, |
| 234 | -1, |
| 235 | -1, |
| 236 | -1, |
| 237 | -1, |
| 238 | -1, |
| 239 | -1, |
| 240 | -1, |
| 241 | -1, |
| 242 | -1, |
| 243 | -1, |
| 244 | -1, |
| 245 | -1, |
| 246 | -1, |
| 247 | -1, |
| 248 | -1, |
| 249 | -1, |
| 250 | -1, |
| 251 | -1, |
| 252 | -1, |
| 253 | -1, |
| 254 | -1, |
| 255 | -1, |
| 256 | -1, |
| 257 | -1, |
| 258 | -1, |
| 259 | -1, |
| 260 | -1, |
| 261 | -1, |
| 262 | -1, |
| 263 | -1, |
| 264 | -1, |
| 265 | -1, |
| 266 | -1, |
| 267 | -1, |
| 268 | -1, |
| 269 | }; |
| 270 | |
| 271 | // input | code: code pointer start from varuint32 |
| 272 | // | code_len: real code len count from varint |
| 273 | // | leng: return value, means length of varint. -1 means error |
| 274 | // return | varint |
| 275 | static uint32_tcxx . . $ uint32_t# get_varuint32cxx . . $ get_varuint32(47ec3ebf21bc50ab).(const uint8_tcxx . . $ uint8_t# *code, size_tcxx . . $ size_t# code_len, size_tcxx . . $ size_t# *leng) |
| 276 | { |
| 277 | uint32_tcxx . . $ uint32_t# data = 0; |
| 278 | int i; |
| 279 | |
| 280 | for(i = 0;; i++) { |
| 281 | if (code_len < i + 1) { |
| 282 | *leng = -1; |
| 283 | return 0; |
| 284 | } |
| 285 | |
| 286 | |
| 287 | if (i > 4 || (i == 4 && (code[i] & 0x7f) > 0x0f)) { |
| 288 | *leng = -1; |
| 289 | return 0; |
| 290 | } |
| 291 | |
| 292 | data = data + (((uint32_tcxx . . $ uint32_t#) code[i] & 0x7f) << (i * 7)); |
| 293 | if (code[i] >> 7 == 0) { |
| 294 | break; |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | *leng = i + 1; |
| 299 | |
| 300 | return data; |
| 301 | } |
| 302 | |
| 303 | // input | code : code pointer start from varuint64 |
| 304 | // | code_len : real code len count from varint |
| 305 | // | leng: return value, means length of varint. -1 means error |
| 306 | // return | varint |
| 307 | static uint64_tcxx . . $ uint64_t# get_varuint64cxx . . $ get_varuint64(f5d0f3a8e7d2af7b).(const uint8_tcxx . . $ uint8_t# *code, size_tcxx . . $ size_t# code_len, size_tcxx . . $ size_t# *leng) |
| 308 | { |
| 309 | uint64_tcxx . . $ uint64_t# data; |
| 310 | int i; |
| 311 | |
| 312 | data = 0; |
| 313 | for(i = 0;; i++){ |
| 314 | if (code_len < i + 1) { |
| 315 | *leng = -1; |
| 316 | return 0; |
| 317 | } |
| 318 | |
| 319 | if (i > 9 || (i == 9 && (code[i] & 0x7f) > 0x01)) { |
| 320 | *leng = -1; |
| 321 | return 0; |
| 322 | } |
| 323 | |
| 324 | data = data + (((uint64_tcxx . . $ uint64_t#) code[i] & 0x7f) << (i * 7)); |
| 325 | if (code[i] >> 7 == 0) { |
| 326 | break; |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | *leng = i + 1; |
| 331 | |
| 332 | return data; |
| 333 | } |
| 334 | |
| 335 | // input | code : code pointer start from uint32 |
| 336 | // | dest : the pointer where we store the uint32 |
| 337 | // return | None |
| 338 | static void get_uint32cxx . . $ get_uint32(c4f0954631f88756).(const uint8_tcxx . . $ uint8_t# *code, uint32_tcxx . . $ uint32_t# *dest) |
| 339 | { |
| 340 | memcpycxx . . $ memcpy(cc817cb175f282d).(dest, code, 4); |
| 341 | } |
| 342 | |
| 343 | // input | code : code pointer start from uint32 |
| 344 | // | dest : the pointer where we store the uint64 |
| 345 | // return | None |
| 346 | static void get_uint64cxx . . $ get_uint64(375cf4c4d8334859).(const uint8_tcxx . . $ uint8_t# *code, uint64_tcxx . . $ uint64_t# *dest) |
| 347 | { |
| 348 | memcpycxx . . $ memcpy(cc817cb175f282d).(dest, code, 8); |
| 349 | } |
| 350 | |
| 351 | // input | code : code pointer start from varint7 |
| 352 | // | code_len : start from the code pointer to the end, how long is it |
| 353 | // | leng : length of the param , -1 means error |
| 354 | // return | data of varint7 |
| 355 | static int8_tcxx . . $ int8_t# get_varint7cxx . . $ get_varint7(23535ce0cbfc2ed4).(const uint8_tcxx . . $ uint8_t# *code, size_tcxx . . $ size_t# code_len, size_tcxx . . $ size_t# *leng) |
| 356 | { |
| 357 | int8_tcxx . . $ int8_t# data; |
| 358 | |
| 359 | if (code_len < 1) { |
| 360 | *leng = -1; |
| 361 | return -1; |
| 362 | } |
| 363 | |
| 364 | *leng = 1; |
| 365 | |
| 366 | if (code[0] == 0x40) { |
| 367 | return -1; |
| 368 | } |
| 369 | |
| 370 | data = code[0] & 0x7f; |
| 371 | |
| 372 | return data; |
| 373 | } |
| 374 | |
| 375 | // input | code : code pointer start from varuint32 |
| 376 | // | code_len : start from the code pointer to the end, how long is it |
| 377 | // | param_size : pointer of the param size |
| 378 | // | MI : Mcinst handler in this round of disasm |
| 379 | // return | true/false if the function successfully finished |
| 380 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! read_varuint32cxx . . $ read_varuint32(85b87288b0f3bd62).(const uint8_tcxx . . $ uint8_t# *code, size_tcxx . . $ size_t# code_len, uint16_tcxx . . $ uint16_t# *param_size, MCInstcxx . . $ MCInst# *MI) |
| 381 | { |
| 382 | size_tcxx . . $ size_t# len = 0; |
| 383 | uint32_tcxx . . $ uint32_t# data; |
| 384 | |
| 385 | data = get_varuint32cxx . . $ get_varuint32(47ec3ebf21bc50ab).(code, code_len, &len); |
| 386 | if (len == -1) { |
| 387 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 388 | } |
| 389 | |
| 390 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 391 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 392 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].typecxx . . $ cs_wasm_op#type. = WASM_OP_VARUINT32cxx . . $ WASM_OP_VARUINT32.; |
| 393 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].sizecxx . . $ cs_wasm_op#size.= len; |
| 394 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].varuint32cxx . . $ cs_wasm_op#$anonymous_type_0#varuint32.= data; |
| 395 | } |
| 396 | |
| 397 | MI->wasm_datacxx . . $ MCInst#wasm_data..sizecxx . . $ cs_wasm_op#size. = len; |
| 398 | MI->wasm_datacxx . . $ MCInst#wasm_data..typecxx . . $ cs_wasm_op#type. = WASM_OP_VARUINT32cxx . . $ WASM_OP_VARUINT32.; |
| 399 | MI->wasm_datacxx . . $ MCInst#wasm_data..uint32cxx . . $ cs_wasm_op#$anonymous_type_0#uint32. = data; |
| 400 | *param_size = len; |
| 401 | |
| 402 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 403 | } |
| 404 | |
| 405 | // input | code : code pointer start from varuint64 |
| 406 | // | code_len : start from the code pointer to the end, how long is it |
| 407 | // | param_size : pointer of the param size |
| 408 | // | MI : Mcinst handler in this round of disasm |
| 409 | // return | true/false if the function successfully finished |
| 410 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! read_varuint64cxx . . $ read_varuint64(85b87288b0f3bd62).(const uint8_tcxx . . $ uint8_t# *code, size_tcxx . . $ size_t# code_len, uint16_tcxx . . $ uint16_t# *param_size, MCInstcxx . . $ MCInst# *MI) |
| 411 | { |
| 412 | size_tcxx . . $ size_t# len = 0; |
| 413 | uint64_tcxx . . $ uint64_t# data; |
| 414 | |
| 415 | data = get_varuint64cxx . . $ get_varuint64(f5d0f3a8e7d2af7b).(code, code_len, &len); |
| 416 | if (len == -1) { |
| 417 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 418 | } |
| 419 | |
| 420 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 421 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 422 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].typecxx . . $ cs_wasm_op#type. = WASM_OP_VARUINT64cxx . . $ WASM_OP_VARUINT64.; |
| 423 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].sizecxx . . $ cs_wasm_op#size. = len; |
| 424 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].varuint64cxx . . $ cs_wasm_op#$anonymous_type_0#varuint64. = data; |
| 425 | } |
| 426 | |
| 427 | MI->wasm_datacxx . . $ MCInst#wasm_data..sizecxx . . $ cs_wasm_op#size. = len; |
| 428 | MI->wasm_datacxx . . $ MCInst#wasm_data..typecxx . . $ cs_wasm_op#type. = WASM_OP_VARUINT64cxx . . $ WASM_OP_VARUINT64.; |
| 429 | MI->wasm_datacxx . . $ MCInst#wasm_data..uint64cxx . . $ cs_wasm_op#$anonymous_type_0#uint64. = data; |
| 430 | *param_size = len; |
| 431 | |
| 432 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 433 | } |
| 434 | |
| 435 | // input | code : code pointer start from memoryimmediate |
| 436 | // | code_len : start from the code pointer to the end, how long is it |
| 437 | // | param_size : pointer of the param size (sum of two params) |
| 438 | // | MI : Mcinst handler in this round of disasm |
| 439 | // return | true/false if the function successfully finished |
| 440 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! read_memoryimmediatecxx . . $ read_memoryimmediate(85b87288b0f3bd62).(const uint8_tcxx . . $ uint8_t# *code, size_tcxx . . $ size_t# code_len, uint16_tcxx . . $ uint16_t# *param_size, MCInstcxx . . $ MCInst# *MI) |
| 441 | { |
| 442 | size_tcxx . . $ size_t# tmp, len = 0; |
| 443 | uint32_tcxx . . $ uint32_t# data[2]; |
| 444 | |
| 445 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 446 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 2; |
| 447 | } |
| 448 | |
| 449 | data[0] = get_varuint32cxx . . $ get_varuint32(47ec3ebf21bc50ab).(code, code_len, &tmp); |
| 450 | if (tmp == -1) { |
| 451 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 452 | } |
| 453 | |
| 454 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 455 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].typecxx . . $ cs_wasm_op#type. = WASM_OP_VARUINT32cxx . . $ WASM_OP_VARUINT32.; |
| 456 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].sizecxx . . $ cs_wasm_op#size. = tmp; |
| 457 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].varuint32cxx . . $ cs_wasm_op#$anonymous_type_0#varuint32. = data[0]; |
| 458 | } |
| 459 | |
| 460 | len = tmp; |
| 461 | data[1] = get_varuint32cxx . . $ get_varuint32(47ec3ebf21bc50ab).(&code[len], code_len - len, &tmp); |
| 462 | if (len == -1) { |
| 463 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 464 | } |
| 465 | |
| 466 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 467 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[1].typecxx . . $ cs_wasm_op#type. = WASM_OP_VARUINT32cxx . . $ WASM_OP_VARUINT32.; |
| 468 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[1].sizecxx . . $ cs_wasm_op#size. = tmp; |
| 469 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[1].varuint32cxx . . $ cs_wasm_op#$anonymous_type_0#varuint32. = data[1]; |
| 470 | } |
| 471 | |
| 472 | len += tmp; |
| 473 | MI->wasm_datacxx . . $ MCInst#wasm_data..sizecxx . . $ cs_wasm_op#size. = len; |
| 474 | MI->wasm_datacxx . . $ MCInst#wasm_data..typecxx . . $ cs_wasm_op#type. = WASM_OP_IMMcxx . . $ WASM_OP_IMM.; |
| 475 | MI->wasm_datacxx . . $ MCInst#wasm_data..immediatecxx . . $ cs_wasm_op#$anonymous_type_0#immediate.[0] = data[0]; |
| 476 | MI->wasm_datacxx . . $ MCInst#wasm_data..immediatecxx . . $ cs_wasm_op#$anonymous_type_0#immediate.[1] = data[1]; |
| 477 | *param_size = len; |
| 478 | |
| 479 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 480 | } |
| 481 | |
| 482 | // input | code : code pointer start from uint32 |
| 483 | // | code_len : start from the code pointer to the end, how long is it |
| 484 | // | param_size : pointer of the param size |
| 485 | // | MI : Mcinst handler in this round of disasm |
| 486 | // return | true/false if the function successfully finished |
| 487 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! read_uint32cxx . . $ read_uint32(85b87288b0f3bd62).(const uint8_tcxx . . $ uint8_t# *code, size_tcxx . . $ size_t# code_len, uint16_tcxx . . $ uint16_t# *param_size, MCInstcxx . . $ MCInst# *MI) |
| 488 | { |
| 489 | if (code_len < 4) { |
| 490 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 491 | } |
| 492 | |
| 493 | get_uint32cxx . . $ get_uint32(c4f0954631f88756).(code, &(MI->wasm_datacxx . . $ MCInst#wasm_data..uint32cxx . . $ cs_wasm_op#$anonymous_type_0#uint32.)); |
| 494 | |
| 495 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 496 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 497 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].typecxx . . $ cs_wasm_op#type. = WASM_OP_UINT32cxx . . $ WASM_OP_UINT32.; |
| 498 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].sizecxx . . $ cs_wasm_op#size. = 4; |
| 499 | get_uint32cxx . . $ get_uint32(c4f0954631f88756).(code, &(MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].uint32cxx . . $ cs_wasm_op#$anonymous_type_0#uint32.)); |
| 500 | } |
| 501 | |
| 502 | MI->wasm_datacxx . . $ MCInst#wasm_data..sizecxx . . $ cs_wasm_op#size. = 4; |
| 503 | MI->wasm_datacxx . . $ MCInst#wasm_data..typecxx . . $ cs_wasm_op#type. = WASM_OP_UINT32cxx . . $ WASM_OP_UINT32.; |
| 504 | *param_size = 4; |
| 505 | |
| 506 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 507 | } |
| 508 | |
| 509 | // input | code : code pointer start from uint64 |
| 510 | // | code_len : start from the code pointer to the end, how long is it |
| 511 | // | param_size : pointer of the param size |
| 512 | // | MI : Mcinst handler in this round of disasm |
| 513 | // return | true/false if the function successfully finished |
| 514 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! read_uint64cxx . . $ read_uint64(85b87288b0f3bd62).(const uint8_tcxx . . $ uint8_t# *code, size_tcxx . . $ size_t# code_len, uint16_tcxx . . $ uint16_t# *param_size, MCInstcxx . . $ MCInst# *MI) |
| 515 | { |
| 516 | if (code_len < 8) { |
| 517 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 518 | } |
| 519 | |
| 520 | get_uint64cxx . . $ get_uint64(375cf4c4d8334859).(code, &(MI->wasm_datacxx . . $ MCInst#wasm_data..uint64cxx . . $ cs_wasm_op#$anonymous_type_0#uint64.)); |
| 521 | |
| 522 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 523 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 524 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].typecxx . . $ cs_wasm_op#type. = WASM_OP_UINT64cxx . . $ WASM_OP_UINT64.; |
| 525 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].sizecxx . . $ cs_wasm_op#size. = 8; |
| 526 | get_uint64cxx . . $ get_uint64(375cf4c4d8334859).(code, &(MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].uint64cxx . . $ cs_wasm_op#$anonymous_type_0#uint64.)); |
| 527 | } |
| 528 | |
| 529 | MI->wasm_datacxx . . $ MCInst#wasm_data..sizecxx . . $ cs_wasm_op#size. = 8; |
| 530 | MI->wasm_datacxx . . $ MCInst#wasm_data..typecxx . . $ cs_wasm_op#type. = WASM_OP_UINT64cxx . . $ WASM_OP_UINT64.; |
| 531 | *param_size = 8; |
| 532 | |
| 533 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 534 | } |
| 535 | |
| 536 | // input | code : code pointer start from brtable |
| 537 | // | code_len : start from the code pointer to the end, how long is it |
| 538 | // | param_size : pointer of the param size (sum of all param) |
| 539 | // | MI : Mcinst handler in this round of disasm |
| 540 | // return | true/false if the function successfully finished |
| 541 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! read_brtablecxx . . $ read_brtable(85b87288b0f3bd62).(const uint8_tcxx . . $ uint8_t# *code, size_tcxx . . $ size_t# code_len, uint16_tcxx . . $ uint16_t# *param_size, MCInstcxx . . $ MCInst# *MI) |
| 542 | { |
| 543 | uint32_tcxx . . $ uint32_t# length, default_target; |
| 544 | int tmp_len = 0, i; |
| 545 | size_tcxx . . $ size_t# var_len; |
| 546 | |
| 547 | // read length |
| 548 | length = get_varuint32cxx . . $ get_varuint32(47ec3ebf21bc50ab).(code, code_len, &var_len); |
| 549 | if (var_len == -1) { |
| 550 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 551 | } |
| 552 | |
| 553 | tmp_len += var_len; |
| 554 | MI->wasm_datacxx . . $ MCInst#wasm_data..brtablecxx . . $ cs_wasm_op#$anonymous_type_0#brtable..lengthcxx . . $ cs_wasm_brtable#length. = length; |
| 555 | if (length >= UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:124:10`! - tmp_len) { |
| 556 | // integer overflow check |
| 557 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 558 | } |
| 559 | if (code_len < tmp_len + length) { |
| 560 | // safety check that we have minimum enough data to read |
| 561 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 562 | } |
| 563 | // base address + 1 byte opcode + tmp_len for number of cases = start of targets |
| 564 | MI->wasm_datacxx . . $ MCInst#wasm_data..brtablecxx . . $ cs_wasm_op#$anonymous_type_0#brtable..addresscxx . . $ cs_wasm_brtable#address. = MI->addresscxx . . $ MCInst#address. + 1 + tmp_len; |
| 565 | |
| 566 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 567 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 568 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].typecxx . . $ cs_wasm_op#type. = WASM_OP_BRTABLEcxx . . $ WASM_OP_BRTABLE.; |
| 569 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].brtablecxx . . $ cs_wasm_op#$anonymous_type_0#brtable..lengthcxx . . $ cs_wasm_brtable#length. = MI->wasm_datacxx . . $ MCInst#wasm_data..brtablecxx . . $ cs_wasm_op#$anonymous_type_0#brtable..lengthcxx . . $ cs_wasm_brtable#length.; |
| 570 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].brtablecxx . . $ cs_wasm_op#$anonymous_type_0#brtable..addresscxx . . $ cs_wasm_brtable#address. = MI->wasm_datacxx . . $ MCInst#wasm_data..brtablecxx . . $ cs_wasm_op#$anonymous_type_0#brtable..addresscxx . . $ cs_wasm_brtable#address.; |
| 571 | } |
| 572 | |
| 573 | // read data |
| 574 | for(i = 0; i < length; i++){ |
| 575 | if (code_len < tmp_len) { |
| 576 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 577 | } |
| 578 | |
| 579 | get_varuint32cxx . . $ get_varuint32(47ec3ebf21bc50ab).(code + tmp_len, code_len - tmp_len, &var_len); |
| 580 | if (var_len == -1) { |
| 581 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 582 | } |
| 583 | |
| 584 | tmp_len += var_len; |
| 585 | } |
| 586 | |
| 587 | // read default target |
| 588 | default_target = get_varuint32cxx . . $ get_varuint32(47ec3ebf21bc50ab).(code + tmp_len, code_len - tmp_len, &var_len); |
| 589 | if (var_len == -1) { |
| 590 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 591 | } |
| 592 | |
| 593 | MI->wasm_datacxx . . $ MCInst#wasm_data..brtablecxx . . $ cs_wasm_op#$anonymous_type_0#brtable..default_targetcxx . . $ cs_wasm_brtable#default_target. = default_target; |
| 594 | MI->wasm_datacxx . . $ MCInst#wasm_data..typecxx . . $ cs_wasm_op#type. = WASM_OP_BRTABLEcxx . . $ WASM_OP_BRTABLE.; |
| 595 | if ((uint64_tcxx . . $ uint64_t#)(tmp_len + var_len) >= UINT16_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:123:10`!) { |
| 596 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 597 | } |
| 598 | *param_size = tmp_len + var_len; |
| 599 | |
| 600 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 601 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].sizecxx . . $ cs_wasm_op#size. = *param_size; |
| 602 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].brtablecxx . . $ cs_wasm_op#$anonymous_type_0#brtable..default_targetcxx . . $ cs_wasm_brtable#default_target. = MI->wasm_datacxx . . $ MCInst#wasm_data..brtablecxx . . $ cs_wasm_op#$anonymous_type_0#brtable..default_targetcxx . . $ cs_wasm_brtable#default_target.; |
| 603 | } |
| 604 | |
| 605 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 606 | } |
| 607 | |
| 608 | // input | code : code pointer start from varint7 |
| 609 | // | code_len : start from the code pointer to the end, how long is it |
| 610 | // | param_size : pointer of the param size |
| 611 | // | MI : Mcinst handler in this round of disasm |
| 612 | // return | true/false if the function successfully finished |
| 613 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! read_varint7cxx . . $ read_varint7(85b87288b0f3bd62).(const uint8_tcxx . . $ uint8_t# *code, size_tcxx . . $ size_t# code_len, uint16_tcxx . . $ uint16_t# *param_size, MCInstcxx . . $ MCInst# *MI) |
| 614 | { |
| 615 | size_tcxx . . $ size_t# len = 0; |
| 616 | |
| 617 | MI->wasm_datacxx . . $ MCInst#wasm_data..typecxx . . $ cs_wasm_op#type. = WASM_OP_INT7cxx . . $ WASM_OP_INT7.; |
| 618 | MI->wasm_datacxx . . $ MCInst#wasm_data..int7cxx . . $ cs_wasm_op#$anonymous_type_0#int7. = get_varint7cxx . . $ get_varint7(23535ce0cbfc2ed4).(code, code_len, &len); |
| 619 | if (len == -1) { |
| 620 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 621 | } |
| 622 | |
| 623 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 624 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 625 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].typecxx . . $ cs_wasm_op#type. = WASM_OP_INT7cxx . . $ WASM_OP_INT7.; |
| 626 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].sizecxx . . $ cs_wasm_op#size. = 1; |
| 627 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..operandscxx . . $ cs_wasm#operands.[0].int7cxx . . $ cs_wasm_op#$anonymous_type_0#int7. = MI->wasm_datacxx . . $ MCInst#wasm_data..int7cxx . . $ cs_wasm_op#$anonymous_type_0#int7.; |
| 628 | } |
| 629 | |
| 630 | *param_size = len; |
| 631 | |
| 632 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 633 | } |
| 634 | |
| 635 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! WASM_getInstructioncxx . . $ WASM_getInstruction(fe94ce91eeab61e9).(cshcxx . . $ csh# ud, const uint8_tcxx . . $ uint8_t# *code, size_tcxx . . $ size_t# code_len, |
| 636 | MCInstcxx . . $ MCInst# *MI, uint16_tcxx . . $ uint16_t# *size, uint64_tcxx . . $ uint64_t# address, void *inst_info) |
| 637 | { |
| 638 | unsigned char opcode; |
| 639 | uint16_tcxx . . $ uint16_t# param_size; |
| 640 | |
| 641 | if (code_len == 0) |
| 642 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 643 | |
| 644 | opcode = code[0]; |
| 645 | if (opcodescxx . . $ opcodes.[opcode] == -1) { |
| 646 | // invalid opcode |
| 647 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 648 | } |
| 649 | |
| 650 | // valid opcode |
| 651 | MI->addresscxx . . $ MCInst#address. = address; |
| 652 | MI->OpcodePubcxx . . $ MCInst#OpcodePub. = MI->Opcodecxx . . $ MCInst#Opcode. = opcode; |
| 653 | |
| 654 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 655 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail., 0, offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:431:9`!(cs_detail, wasm)+sizeof(cs_wasmcxx . . $ cs_wasm#)); |
| 656 | WASM_get_insn_idcxx . . $ WASM_get_insn_id(b32a94ba649bfb5a).((cs_structcxx . . $ cs_struct# *)ud, MI->flat_insncxx . . $ MCInst#flat_insn., opcode); |
| 657 | } |
| 658 | |
| 659 | // setup groups |
| 660 | switch(opcode) { |
| 661 | default: |
| 662 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 663 | |
| 664 | case WASM_INS_I32_CONSTcxx . . $ WASM_INS_I32_CONST.: |
| 665 | if (code_len == 1 || !read_varuint32cxx . . $ read_varuint32(85b87288b0f3bd62).(&code[1], code_len - 1, ¶m_size, MI)) { |
| 666 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 667 | } |
| 668 | |
| 669 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 670 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 671 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_NUMBERICcxx . . $ WASM_GRP_NUMBERIC.; |
| 672 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 673 | } |
| 674 | |
| 675 | *size = param_size + 1; |
| 676 | |
| 677 | break; |
| 678 | |
| 679 | case WASM_INS_I64_CONSTcxx . . $ WASM_INS_I64_CONST.: |
| 680 | if (code_len == 1 || !read_varuint64cxx . . $ read_varuint64(85b87288b0f3bd62).(&code[1], code_len - 1, ¶m_size, MI)) { |
| 681 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 682 | } |
| 683 | |
| 684 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 685 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 686 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_NUMBERICcxx . . $ WASM_GRP_NUMBERIC.; |
| 687 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 688 | } |
| 689 | |
| 690 | *size = param_size + 1; |
| 691 | |
| 692 | break; |
| 693 | |
| 694 | case WASM_INS_F32_CONSTcxx . . $ WASM_INS_F32_CONST.: |
| 695 | if (code_len == 1 || !read_uint32cxx . . $ read_uint32(85b87288b0f3bd62).(&code[1], code_len - 1, ¶m_size, MI)) { |
| 696 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 697 | } |
| 698 | |
| 699 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 700 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 701 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_NUMBERICcxx . . $ WASM_GRP_NUMBERIC.; |
| 702 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 703 | } |
| 704 | |
| 705 | *size = param_size + 1; |
| 706 | |
| 707 | break; |
| 708 | |
| 709 | case WASM_INS_F64_CONSTcxx . . $ WASM_INS_F64_CONST.: |
| 710 | if (code_len == 1 || !read_uint64cxx . . $ read_uint64(85b87288b0f3bd62).(&code[1], code_len - 1, ¶m_size, MI)) { |
| 711 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 712 | } |
| 713 | |
| 714 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 715 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 716 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_NUMBERICcxx . . $ WASM_GRP_NUMBERIC.; |
| 717 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 718 | } |
| 719 | |
| 720 | *size = param_size + 1; |
| 721 | |
| 722 | break; |
| 723 | |
| 724 | case WASM_INS_I32_EQZcxx . . $ WASM_INS_I32_EQZ.: |
| 725 | case WASM_INS_I32_EQcxx . . $ WASM_INS_I32_EQ.: |
| 726 | case WASM_INS_I32_NEcxx . . $ WASM_INS_I32_NE.: |
| 727 | case WASM_INS_I32_LT_Scxx . . $ WASM_INS_I32_LT_S.: |
| 728 | case WASM_INS_I32_LT_Ucxx . . $ WASM_INS_I32_LT_U.: |
| 729 | case WASM_INS_I32_GT_Scxx . . $ WASM_INS_I32_GT_S.: |
| 730 | case WASM_INS_I32_GT_Ucxx . . $ WASM_INS_I32_GT_U.: |
| 731 | case WASM_INS_I32_LE_Scxx . . $ WASM_INS_I32_LE_S.: |
| 732 | case WASM_INS_I32_LE_Ucxx . . $ WASM_INS_I32_LE_U.: |
| 733 | case WASM_INS_I32_GE_Scxx . . $ WASM_INS_I32_GE_S.: |
| 734 | case WASM_INS_I32_GE_Ucxx . . $ WASM_INS_I32_GE_U.: |
| 735 | case WASM_INS_I64_EQZcxx . . $ WASM_INS_I64_EQZ.: |
| 736 | case WASM_INS_I64_EQcxx . . $ WASM_INS_I64_EQ.: |
| 737 | case WASM_INS_I64_NEcxx . . $ WASM_INS_I64_NE.: |
| 738 | case WASM_INS_I64_LT_Scxx . . $ WASM_INS_I64_LT_S.: |
| 739 | case WASM_INS_I64_LT_Ucxx . . $ WASM_INS_I64_LT_U.: |
| 740 | case WASN_INS_I64_GT_Scxx . . $ WASN_INS_I64_GT_S.: |
| 741 | case WASM_INS_I64_GT_Ucxx . . $ WASM_INS_I64_GT_U.: |
| 742 | case WASM_INS_I64_LE_Scxx . . $ WASM_INS_I64_LE_S.: |
| 743 | case WASM_INS_I64_LE_Ucxx . . $ WASM_INS_I64_LE_U.: |
| 744 | case WASM_INS_I64_GE_Scxx . . $ WASM_INS_I64_GE_S.: |
| 745 | case WASM_INS_I64_GE_Ucxx . . $ WASM_INS_I64_GE_U.: |
| 746 | case WASM_INS_F32_EQcxx . . $ WASM_INS_F32_EQ.: |
| 747 | case WASM_INS_F32_NEcxx . . $ WASM_INS_F32_NE.: |
| 748 | case WASM_INS_F32_LTcxx . . $ WASM_INS_F32_LT.: |
| 749 | case WASM_INS_F32_GTcxx . . $ WASM_INS_F32_GT.: |
| 750 | case WASM_INS_F32_LEcxx . . $ WASM_INS_F32_LE.: |
| 751 | case WASM_INS_F32_GEcxx . . $ WASM_INS_F32_GE.: |
| 752 | case WASM_INS_F64_EQcxx . . $ WASM_INS_F64_EQ.: |
| 753 | case WASM_INS_F64_NEcxx . . $ WASM_INS_F64_NE.: |
| 754 | case WASM_INS_F64_LTcxx . . $ WASM_INS_F64_LT.: |
| 755 | case WASM_INS_F64_GTcxx . . $ WASM_INS_F64_GT.: |
| 756 | case WASM_INS_F64_LEcxx . . $ WASM_INS_F64_LE.: |
| 757 | case WASM_INS_F64_GEcxx . . $ WASM_INS_F64_GE.: |
| 758 | case WASM_INS_I32_CLZcxx . . $ WASM_INS_I32_CLZ.: |
| 759 | case WASM_INS_I32_CTZcxx . . $ WASM_INS_I32_CTZ.: |
| 760 | case WASM_INS_I32_POPCNTcxx . . $ WASM_INS_I32_POPCNT.: |
| 761 | case WASM_INS_I32_ADDcxx . . $ WASM_INS_I32_ADD.: |
| 762 | case WASM_INS_I32_SUBcxx . . $ WASM_INS_I32_SUB.: |
| 763 | case WASM_INS_I32_MULcxx . . $ WASM_INS_I32_MUL.: |
| 764 | case WASM_INS_I32_DIV_Scxx . . $ WASM_INS_I32_DIV_S.: |
| 765 | case WASM_INS_I32_DIV_Ucxx . . $ WASM_INS_I32_DIV_U.: |
| 766 | case WASM_INS_I32_REM_Scxx . . $ WASM_INS_I32_REM_S.: |
| 767 | case WASM_INS_I32_REM_Ucxx . . $ WASM_INS_I32_REM_U.: |
| 768 | case WASM_INS_I32_ANDcxx . . $ WASM_INS_I32_AND.: |
| 769 | case WASM_INS_I32_ORcxx . . $ WASM_INS_I32_OR.: |
| 770 | case WASM_INS_I32_XORcxx . . $ WASM_INS_I32_XOR.: |
| 771 | case WASM_INS_I32_SHLcxx . . $ WASM_INS_I32_SHL.: |
| 772 | case WASM_INS_I32_SHR_Scxx . . $ WASM_INS_I32_SHR_S.: |
| 773 | case WASM_INS_I32_SHR_Ucxx . . $ WASM_INS_I32_SHR_U.: |
| 774 | case WASM_INS_I32_ROTLcxx . . $ WASM_INS_I32_ROTL.: |
| 775 | case WASM_INS_I32_ROTRcxx . . $ WASM_INS_I32_ROTR.: |
| 776 | case WASM_INS_I64_CLZcxx . . $ WASM_INS_I64_CLZ.: |
| 777 | case WASM_INS_I64_CTZcxx . . $ WASM_INS_I64_CTZ.: |
| 778 | case WASM_INS_I64_POPCNTcxx . . $ WASM_INS_I64_POPCNT.: |
| 779 | case WASM_INS_I64_ADDcxx . . $ WASM_INS_I64_ADD.: |
| 780 | case WASM_INS_I64_SUBcxx . . $ WASM_INS_I64_SUB.: |
| 781 | case WASM_INS_I64_MULcxx . . $ WASM_INS_I64_MUL.: |
| 782 | case WASM_INS_I64_DIV_Scxx . . $ WASM_INS_I64_DIV_S.: |
| 783 | case WASM_INS_I64_DIV_Ucxx . . $ WASM_INS_I64_DIV_U.: |
| 784 | case WASM_INS_I64_REM_Scxx . . $ WASM_INS_I64_REM_S.: |
| 785 | case WASM_INS_I64_REM_Ucxx . . $ WASM_INS_I64_REM_U.: |
| 786 | case WASM_INS_I64_ANDcxx . . $ WASM_INS_I64_AND.: |
| 787 | case WASM_INS_I64_ORcxx . . $ WASM_INS_I64_OR.: |
| 788 | case WASM_INS_I64_XORcxx . . $ WASM_INS_I64_XOR.: |
| 789 | case WASM_INS_I64_SHLcxx . . $ WASM_INS_I64_SHL.: |
| 790 | case WASM_INS_I64_SHR_Scxx . . $ WASM_INS_I64_SHR_S.: |
| 791 | case WASM_INS_I64_SHR_Ucxx . . $ WASM_INS_I64_SHR_U.: |
| 792 | case WASM_INS_I64_ROTLcxx . . $ WASM_INS_I64_ROTL.: |
| 793 | case WASM_INS_I64_ROTRcxx . . $ WASM_INS_I64_ROTR.: |
| 794 | case WASM_INS_F32_ABScxx . . $ WASM_INS_F32_ABS.: |
| 795 | case WASM_INS_F32_NEGcxx . . $ WASM_INS_F32_NEG.: |
| 796 | case WASM_INS_F32_CEILcxx . . $ WASM_INS_F32_CEIL.: |
| 797 | case WASM_INS_F32_FLOORcxx . . $ WASM_INS_F32_FLOOR.: |
| 798 | case WASM_INS_F32_TRUNCcxx . . $ WASM_INS_F32_TRUNC.: |
| 799 | case WASM_INS_F32_NEARESTcxx . . $ WASM_INS_F32_NEAREST.: |
| 800 | case WASM_INS_F32_SQRTcxx . . $ WASM_INS_F32_SQRT.: |
| 801 | case WASM_INS_F32_ADDcxx . . $ WASM_INS_F32_ADD.: |
| 802 | case WASM_INS_F32_SUBcxx . . $ WASM_INS_F32_SUB.: |
| 803 | case WASM_INS_F32_MULcxx . . $ WASM_INS_F32_MUL.: |
| 804 | case WASM_INS_F32_DIVcxx . . $ WASM_INS_F32_DIV.: |
| 805 | case WASM_INS_F32_MINcxx . . $ WASM_INS_F32_MIN.: |
| 806 | case WASM_INS_F32_MAXcxx . . $ WASM_INS_F32_MAX.: |
| 807 | case WASM_INS_F32_COPYSIGNcxx . . $ WASM_INS_F32_COPYSIGN.: |
| 808 | case WASM_INS_F64_ABScxx . . $ WASM_INS_F64_ABS.: |
| 809 | case WASM_INS_F64_NEGcxx . . $ WASM_INS_F64_NEG.: |
| 810 | case WASM_INS_F64_CEILcxx . . $ WASM_INS_F64_CEIL.: |
| 811 | case WASM_INS_F64_FLOORcxx . . $ WASM_INS_F64_FLOOR.: |
| 812 | case WASM_INS_F64_TRUNCcxx . . $ WASM_INS_F64_TRUNC.: |
| 813 | case WASM_INS_F64_NEARESTcxx . . $ WASM_INS_F64_NEAREST.: |
| 814 | case WASM_INS_F64_SQRTcxx . . $ WASM_INS_F64_SQRT.: |
| 815 | case WASM_INS_F64_ADDcxx . . $ WASM_INS_F64_ADD.: |
| 816 | case WASM_INS_F64_SUBcxx . . $ WASM_INS_F64_SUB.: |
| 817 | case WASM_INS_F64_MULcxx . . $ WASM_INS_F64_MUL.: |
| 818 | case WASM_INS_F64_DIVcxx . . $ WASM_INS_F64_DIV.: |
| 819 | case WASM_INS_F64_MINcxx . . $ WASM_INS_F64_MIN.: |
| 820 | case WASM_INS_F64_MAXcxx . . $ WASM_INS_F64_MAX.: |
| 821 | case WASM_INS_F64_COPYSIGNcxx . . $ WASM_INS_F64_COPYSIGN.: |
| 822 | case WASM_INS_I32_WARP_I64cxx . . $ WASM_INS_I32_WARP_I64.: |
| 823 | case WASP_INS_I32_TRUNC_S_F32cxx . . $ WASP_INS_I32_TRUNC_S_F32.: |
| 824 | case WASM_INS_I32_TRUNC_U_F32cxx . . $ WASM_INS_I32_TRUNC_U_F32.: |
| 825 | case WASM_INS_I32_TRUNC_S_F64cxx . . $ WASM_INS_I32_TRUNC_S_F64.: |
| 826 | case WASM_INS_I32_TRUNC_U_F64cxx . . $ WASM_INS_I32_TRUNC_U_F64.: |
| 827 | case WASM_INS_I64_EXTEND_S_I32cxx . . $ WASM_INS_I64_EXTEND_S_I32.: |
| 828 | case WASM_INS_I64_EXTEND_U_I32cxx . . $ WASM_INS_I64_EXTEND_U_I32.: |
| 829 | case WASM_INS_I64_TRUNC_S_F32cxx . . $ WASM_INS_I64_TRUNC_S_F32.: |
| 830 | case WASM_INS_I64_TRUNC_U_F32cxx . . $ WASM_INS_I64_TRUNC_U_F32.: |
| 831 | case WASM_INS_I64_TRUNC_S_F64cxx . . $ WASM_INS_I64_TRUNC_S_F64.: |
| 832 | case WASM_INS_I64_TRUNC_U_F64cxx . . $ WASM_INS_I64_TRUNC_U_F64.: |
| 833 | case WASM_INS_F32_CONVERT_S_I32cxx . . $ WASM_INS_F32_CONVERT_S_I32.: |
| 834 | case WASM_INS_F32_CONVERT_U_I32cxx . . $ WASM_INS_F32_CONVERT_U_I32.: |
| 835 | case WASM_INS_F32_CONVERT_S_I64cxx . . $ WASM_INS_F32_CONVERT_S_I64.: |
| 836 | case WASM_INS_F32_CONVERT_U_I64cxx . . $ WASM_INS_F32_CONVERT_U_I64.: |
| 837 | case WASM_INS_F32_DEMOTE_F64cxx . . $ WASM_INS_F32_DEMOTE_F64.: |
| 838 | case WASM_INS_F64_CONVERT_S_I32cxx . . $ WASM_INS_F64_CONVERT_S_I32.: |
| 839 | case WASM_INS_F64_CONVERT_U_I32cxx . . $ WASM_INS_F64_CONVERT_U_I32.: |
| 840 | case WASM_INS_F64_CONVERT_S_I64cxx . . $ WASM_INS_F64_CONVERT_S_I64.: |
| 841 | case WASM_INS_F64_CONVERT_U_I64cxx . . $ WASM_INS_F64_CONVERT_U_I64.: |
| 842 | case WASM_INS_F64_PROMOTE_F32cxx . . $ WASM_INS_F64_PROMOTE_F32.: |
| 843 | case WASM_INS_I32_REINTERPRET_F32cxx . . $ WASM_INS_I32_REINTERPRET_F32.: |
| 844 | case WASM_INS_I64_REINTERPRET_F64cxx . . $ WASM_INS_I64_REINTERPRET_F64.: |
| 845 | case WASM_INS_F32_REINTERPRET_I32cxx . . $ WASM_INS_F32_REINTERPRET_I32.: |
| 846 | case WASM_INS_F64_REINTERPRET_I64cxx . . $ WASM_INS_F64_REINTERPRET_I64.: |
| 847 | MI->wasm_datacxx . . $ MCInst#wasm_data..typecxx . . $ cs_wasm_op#type. = WASM_OP_NONEcxx . . $ WASM_OP_NONE.; |
| 848 | |
| 849 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 850 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 0; |
| 851 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_NUMBERICcxx . . $ WASM_GRP_NUMBERIC.; |
| 852 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 853 | } |
| 854 | |
| 855 | *size = 1; |
| 856 | |
| 857 | break; |
| 858 | |
| 859 | case WASM_INS_DROPcxx . . $ WASM_INS_DROP.: |
| 860 | case WASM_INS_SELECTcxx . . $ WASM_INS_SELECT.: |
| 861 | MI->wasm_datacxx . . $ MCInst#wasm_data..typecxx . . $ cs_wasm_op#type. = WASM_OP_NONEcxx . . $ WASM_OP_NONE.; |
| 862 | |
| 863 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 864 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 0; |
| 865 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_PARAMETRICcxx . . $ WASM_GRP_PARAMETRIC.; |
| 866 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 867 | } |
| 868 | |
| 869 | *size = 1; |
| 870 | |
| 871 | break; |
| 872 | |
| 873 | case WASM_INS_GET_LOCALcxx . . $ WASM_INS_GET_LOCAL.: |
| 874 | case WASM_INS_SET_LOCALcxx . . $ WASM_INS_SET_LOCAL.: |
| 875 | case WASM_INS_TEE_LOCALcxx . . $ WASM_INS_TEE_LOCAL.: |
| 876 | case WASM_INS_GET_GLOBALcxx . . $ WASM_INS_GET_GLOBAL.: |
| 877 | case WASM_INS_SET_GLOBALcxx . . $ WASM_INS_SET_GLOBAL.: |
| 878 | if (code_len == 1 || !read_varuint32cxx . . $ read_varuint32(85b87288b0f3bd62).(&code[1], code_len - 1, ¶m_size, MI)) { |
| 879 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 880 | } |
| 881 | |
| 882 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 883 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 884 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_VARIABLEcxx . . $ WASM_GRP_VARIABLE.; |
| 885 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 886 | } |
| 887 | |
| 888 | *size = param_size + 1; |
| 889 | |
| 890 | break; |
| 891 | |
| 892 | case WASM_INS_I32_LOADcxx . . $ WASM_INS_I32_LOAD.: |
| 893 | case WASM_INS_I64_LOADcxx . . $ WASM_INS_I64_LOAD.: |
| 894 | case WASM_INS_F32_LOADcxx . . $ WASM_INS_F32_LOAD.: |
| 895 | case WASM_INS_F64_LOADcxx . . $ WASM_INS_F64_LOAD.: |
| 896 | case WASM_INS_I32_LOAD8_Scxx . . $ WASM_INS_I32_LOAD8_S.: |
| 897 | case WASM_INS_I32_LOAD8_Ucxx . . $ WASM_INS_I32_LOAD8_U.: |
| 898 | case WASM_INS_I32_LOAD16_Scxx . . $ WASM_INS_I32_LOAD16_S.: |
| 899 | case WASM_INS_I32_LOAD16_Ucxx . . $ WASM_INS_I32_LOAD16_U.: |
| 900 | case WASM_INS_I64_LOAD8_Scxx . . $ WASM_INS_I64_LOAD8_S.: |
| 901 | case WASM_INS_I64_LOAD8_Ucxx . . $ WASM_INS_I64_LOAD8_U.: |
| 902 | case WASM_INS_I64_LOAD16_Scxx . . $ WASM_INS_I64_LOAD16_S.: |
| 903 | case WASM_INS_I64_LOAD16_Ucxx . . $ WASM_INS_I64_LOAD16_U.: |
| 904 | case WASM_INS_I64_LOAD32_Scxx . . $ WASM_INS_I64_LOAD32_S.: |
| 905 | case WASM_INS_I64_LOAD32_Ucxx . . $ WASM_INS_I64_LOAD32_U.: |
| 906 | case WASM_INS_I32_STOREcxx . . $ WASM_INS_I32_STORE.: |
| 907 | case WASM_INS_I64_STOREcxx . . $ WASM_INS_I64_STORE.: |
| 908 | case WASM_INS_F32_STOREcxx . . $ WASM_INS_F32_STORE.: |
| 909 | case WASM_INS_F64_STOREcxx . . $ WASM_INS_F64_STORE.: |
| 910 | case WASM_INS_I32_STORE8cxx . . $ WASM_INS_I32_STORE8.: |
| 911 | case WASM_INS_I32_STORE16cxx . . $ WASM_INS_I32_STORE16.: |
| 912 | case WASM_INS_I64_STORE8cxx . . $ WASM_INS_I64_STORE8.: |
| 913 | case WASM_INS_I64_STORE16cxx . . $ WASM_INS_I64_STORE16.: |
| 914 | case WASM_INS_I64_STORE32cxx . . $ WASM_INS_I64_STORE32.: |
| 915 | if (code_len == 1 || !read_memoryimmediatecxx . . $ read_memoryimmediate(85b87288b0f3bd62).(&code[1], code_len - 1, ¶m_size, MI)) { |
| 916 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 917 | } |
| 918 | |
| 919 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 920 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 2; |
| 921 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_MEMORYcxx . . $ WASM_GRP_MEMORY.; |
| 922 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 923 | } |
| 924 | |
| 925 | *size = param_size + 1; |
| 926 | |
| 927 | break; |
| 928 | |
| 929 | case WASM_INS_CURRENT_MEMORYcxx . . $ WASM_INS_CURRENT_MEMORY.: |
| 930 | case WASM_INS_GROW_MEMORYcxx . . $ WASM_INS_GROW_MEMORY.: |
| 931 | MI->wasm_datacxx . . $ MCInst#wasm_data..typecxx . . $ cs_wasm_op#type. = WASM_OP_NONEcxx . . $ WASM_OP_NONE.; |
| 932 | |
| 933 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 934 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 0; |
| 935 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_MEMORYcxx . . $ WASM_GRP_MEMORY.; |
| 936 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 937 | } |
| 938 | |
| 939 | *size = 1; |
| 940 | |
| 941 | break; |
| 942 | |
| 943 | case WASM_INS_UNREACHABLEcxx . . $ WASM_INS_UNREACHABLE.: |
| 944 | case WASM_INS_NOPcxx . . $ WASM_INS_NOP.: |
| 945 | case WASM_INS_ELSEcxx . . $ WASM_INS_ELSE.: |
| 946 | case WASM_INS_ENDcxx . . $ WASM_INS_END.: |
| 947 | case WASM_INS_RETURNcxx . . $ WASM_INS_RETURN.: |
| 948 | MI->wasm_datacxx . . $ MCInst#wasm_data..typecxx . . $ cs_wasm_op#type. = WASM_OP_NONEcxx . . $ WASM_OP_NONE.; |
| 949 | |
| 950 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 951 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 0; |
| 952 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_CONTROLcxx . . $ WASM_GRP_CONTROL.; |
| 953 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 954 | } |
| 955 | |
| 956 | *size = 1; |
| 957 | |
| 958 | break; |
| 959 | |
| 960 | case WASM_INS_BLOCKcxx . . $ WASM_INS_BLOCK.: |
| 961 | case WASM_INS_LOOPcxx . . $ WASM_INS_LOOP.: |
| 962 | case WASM_INS_IFcxx . . $ WASM_INS_IF.: |
| 963 | if (code_len == 1 || !read_varint7cxx . . $ read_varint7(85b87288b0f3bd62).(&code[1], code_len - 1, ¶m_size, MI)) { |
| 964 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 965 | } |
| 966 | |
| 967 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 968 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 969 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_CONTROLcxx . . $ WASM_GRP_CONTROL.; |
| 970 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 971 | } |
| 972 | |
| 973 | *size = param_size + 1; |
| 974 | |
| 975 | break; |
| 976 | |
| 977 | case WASM_INS_BRcxx . . $ WASM_INS_BR.: |
| 978 | case WASM_INS_BR_IFcxx . . $ WASM_INS_BR_IF.: |
| 979 | case WASM_INS_CALLcxx . . $ WASM_INS_CALL.: |
| 980 | case WASM_INS_CALL_INDIRECTcxx . . $ WASM_INS_CALL_INDIRECT.: |
| 981 | if (code_len == 1 || !read_varuint32cxx . . $ read_varuint32(85b87288b0f3bd62).(&code[1], code_len - 1, ¶m_size, MI)) { |
| 982 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 983 | } |
| 984 | |
| 985 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 986 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 987 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_CONTROLcxx . . $ WASM_GRP_CONTROL.; |
| 988 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 989 | } |
| 990 | |
| 991 | *size = param_size + 1; |
| 992 | |
| 993 | break; |
| 994 | |
| 995 | case WASM_INS_BR_TABLEcxx . . $ WASM_INS_BR_TABLE.: |
| 996 | if (code_len == 1 || !read_brtablecxx . . $ read_brtable(85b87288b0f3bd62).(&code[1], code_len - 1, ¶m_size, MI)) { |
| 997 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 998 | } |
| 999 | |
| 1000 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 1001 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->wasmcxx . . $ cs_detail#$anonymous_type_0#wasm..op_countcxx . . $ cs_wasm#op_count. = 1; |
| 1002 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = WASM_GRP_CONTROLcxx . . $ WASM_GRP_CONTROL.; |
| 1003 | MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 1004 | } |
| 1005 | |
| 1006 | *size = param_size + 1; |
| 1007 | |
| 1008 | break; |
| 1009 | } |
| 1010 | |
| 1011 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 1012 | } |