One function, four views
The recorded run of rea function on ledger-arm64-O1 for _percent_change with the Ghidra provider, drawn as machines on one bench. You call rea 6.7.0, which hands the question to the BinarySession bound to ghidra, which calls the GhidraClient over bridge.sock, which launches Ghidra 12.1.4 as a headless JVM that imports and analyzes the artifact ledger-arm64-O1, a mach-o arm64 executable of 33872 bytes drawn as a stack of its file segments: __TEXT 16384 bytes, __DATA_CONST 16384 bytes, and __LINKEDIT 1104 bytes. The 24 bytes of _percent_change sit at 0x100000500 near the top of __TEXT. Three columns show the same function: the C you wrote in ledger.c, the pseudocode Ghidra decompiled with a second zero check the source never had, and the six instructions clang -O1 made from cbz w0 at 0x100000500 to ret at 0x100000514. The Evidence record ev_b492c85e at the bottom names the operation analyze_function, the provider ghidra 12.1.4, confidence observed, ten limitations, and the subject.
FOUR VIEWS
rea function ledger-arm64-O1 _percent_change --provider ghidra
you
ledger.c
rea 6.7.0
the CLI
BinarySession
ghidra bound
GhidraClient
bridge.sock
Ghidra 12.1.4
headless JVM
ledger-arm64-O1
mach-o arm64
33872 bytes
sha256 01b5d08b
function
execute
call
launch
import
_percent_change
24 bytes
at 0x100000500
you wrote · ledger.c
int percent_change(
int before, int after) {
if (before == 0)
return 0;
return (after - before)
* 100 / before;
}
Ghidra decompiled
ulong _percent_change(
ulong param_1,int param_2)
iVar2 = (int)param_1;
if (iVar2 != 0) {
uVar1 = 0;
if (iVar2 != 0) {
uVar1 = ((param_2 - iVar2)
* 100) / iVar2;
param_1 = (ulong)uVar1;
return param_1;
clang -O1 made · 24 bytes
500 cbz w0, 0x100000514
504 sub w8, w1, w0
508 mov w9, #0x64
50c mul w8, w8, w9
510 sdiv w0, w8, w0
514 ret
recorded
Evidence ev_b492c85e for _percent_change
operation analyze_function · provider ghidra 12.1.4
confidence observed · 10 limitations
subject ledger-arm64-O1 · mach-o arm64