ACPI AML decompiler w/ CFG recovery and structured pseudocode
1#include "t.h"
2
3#include "js.h"
4#include "p.h"
5
6int t_js(void) {
7 uint8_t data[] = {0x08,'S','T','R','0',0x0d,'a','"','b','\\','c',0x00,0xfe};
8 tobi_parse_result r;
9 T_CHECK(tobi_parse(data, sizeof(data), 0, &r));
10 char *s = tobi_js_emit(&r);
11 T_STR(s, "\"kind\":\"root\"");
12 T_STR(s, "\"checksum_sum\":0");
13 T_STR(s, "\"checksum_valid\":false");
14 T_STR(s, "a\\\"b\\\\c");
15 T_STR(s, "\"raw_opcode\":254");
16 T_CHECK(strstr(s, ",}") == NULL);
17 T_CHECK(strstr(s, ",]") == NULL);
18 free(s);
19 tobi_parse_result_free(&r);
20 return 0;
21}