The five code views
The tabs above the main area switch between views of the current function: the one you last opened from the Functions list, by following a call, or through the go-to box. The function’s name is shown as a heading, with a Rename button and a line saying how many instructions it has and how many places call it.
Assembly
Section titled “Assembly”One line per processor instruction.
14000A3A1 lea rax, [0x14000A630] ; sub_14000A63014000A3BA call qword ptr [0x140029BD8] ; USER32.dll!RegisterClassExWReading a line from left to right:
- Address (grey): where this instruction sits in memory.
- Raw bytes (only if you tick raw bytes): the actual bytes of the instruction.
- Instruction name, colour-coded: calls in yellow, jumps in purple or orange, returns in red, everything else plain.
- Operands: what the instruction works on. When a call or jump goes to a known place, its name is shown in the accent colour instead of a bare address.
- Comment (green, after a semicolon): what the line refers to, such as the Windows function being called or the text being loaded.
- Your note (after
//), if you added one.
Other things you will see:
loc_14000A3F0:on its own line marks a place that a jump inside this function goes to.; 13 bytes of fillerreplaces a run of padding instructions between pieces of code.db 0x1e, 0xfdwith the comment “not valid code, probably data” means those bytes are not an instruction.- A coloured bar at the left edge marks a bookmarked line.
What you can do:
- Click a line to select it. The details panel explains it.
- Double-click a call or jump to follow it.
- Hold the mouse still over a line for about half a second to get a quick explanation without clicking.
C code
Section titled “C code”The same function rewritten as rough C-like code:
i64 sub_140001094(i64 arg1, i64 arg2){ var_20 = 4; rdx = *(u64*)arg_40; if (rdx == 0) { rax = r8; } else { do { rax++; } while (*(u16*)(rdx + rax * 2) != r9); } return rax;}Calls to common Windows functions are shown with the right number of arguments and with well-known numbers given their names:
v1 = GetStdHandle(STD_OUTPUT_HANDLE);v2 = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);v3 = VirtualAlloc(0, 0x1000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);Hold the mouse still over such a line and a box names each argument and says in one sentence what the function does. More than 500 functions are covered: files, memory, processes, the registry, networking, cryptography, services, windows and the keyboard, and the common C library functions.
How to read it:
| You see | It means |
|---|---|
arg1, arg2, … |
The function’s inputs, in order (64-bit programs) |
arg_4, arg_8, … |
Inputs passed on the stack (32-bit programs) |
arg_ecx, arg_edx |
Inputs passed in a register (32-bit programs). arg_ecx is very often the object a method works on |
var_20, var_38, … |
Local variables on the stack. The number is their position |
v1, v2, … |
Local variables. A value that travels through a register from one part of the function to another (a loop counter, a result) gets one name for its whole life. Numbered in reading order |
rax, rbx, ecx, … |
A register whose value Karak Studio cannot account for on every path: for example, a value left over from before the function started, or from a call that may never return |
p[i] |
Item i of something used as an array. Shown when every access to p uses the same item size and at least one uses a changing position. p[i] on 4-byte items means *(u32*)(p + i * 4) |
u8* arg1 in the first line |
An argument used as an array of 1-byte items (usually text). u16*, u32*, u64* likewise |
p->field_18 |
The field at offset 0x18 of a record (a C struct) that p points to. Shown when p is read or written at two or more fixed offsets that do not overlap |
// rec1: what arg1 points to ... |
The record layout Karak Studio worked out from the reads and writes: each field’s offset and size. Real names are unknown, so fields are named by offset, as Ghidra does. rec1* arg1 in the first line means the argument points to that record |
g_140034400 |
A global variable at that address |
*(u32*)(rcx + 0x10) |
The 4-byte value stored at the address rcx + 0x10. u8, u16, u32, u64 are 1, 2, 4 and 8 bytes |
&var_38 |
The address of a local variable |
a ? b : c |
“If a then b, otherwise c”, as one value |
MEM_COMMIT, GENERIC_READ, … |
The Windows name for a number passed to a Windows function |
memcpy(...), memset(...) |
Usually a real call. Sometimes a copy or fill the compiler wrote out in place (rep movs, rep stos), shown the same way because it does the same thing |
_InterlockedExchange(...), _InterlockedCompareExchange(...), _InterlockedExchangeAdd(...) |
One instruction that swaps or adds to a value in memory in a way that is safe between threads. Not a real call |
NtCurrentTeb(), NtCurrentPeb() |
Windows’ own data block for this thread (TEB) or this process (PEB), read through the fs or gs register. Programs that read the PEB by hand are often checking for a debugger or looking up functions without importing them |
__rol(x, n), __ror(x, n), __byteswap(x), __mulhigh(a, b) |
Rotate bits left or right, reverse the byte order, the upper half of a multiplication. C has no symbol for these |
carry |
The carry left over by the addition or subtraction just before, when it could not be written as a formula |
... as a last argument |
More arguments were passed, but they were set up in an earlier part of the function |
label_14000A3F0: and goto |
A jump Karak Studio could not turn into an if or a loop |
__asm("...") |
An instruction it does not model, shown as is |
switch (x) { case 1: ... } |
A switch the compiler built as a jump table: a list of addresses, one per case. Cases that share code are listed together (case 0: case 4:). default: is where every other value goes |
// runs on into the next case |
That case has no break: it carries straight on into the code of the case below, as C allows |
case 'a': |
The cases are letters: the value is compared with characters |
goto *...; // jump table |
A jump through a table Karak Studio could not read, or some other computed jump. Its destinations are not followed |
// ud2: ... |
An instruction that stops the program on purpose. Compilers put one after a call that never returns |
What you can do:
- Click a line to select the instruction it came from. In the Split view look, the assembly beside it scrolls to match.
- Double-click a line that calls another function to open that function.
The C view is a guess built on top of the assembly. Its known weaknesses:
- For functions it does not know (the program’s own, and less common Windows ones) the arguments are a guess. On 64-bit programs that is at most four, and only those set up in the same stretch of code as the call.
- An argument set up in an earlier part of the function may be missing from a call.
- Types are minimal: arrays and records are recognised from how memory is used, everything else is a plain number. Records are only guessed: two unrelated pointers are never known to be the same kind of record, a field read only once is not enough to make a record, and an array of records (
p[i].field) is not recognised. - Arithmetic on pointers is in bytes, even for a record pointer:
v2 += 0x28moves 0x28 bytes, not 0x28 records.i64in front of a function only means “it returns something”;voidmeans it does not. - Writing to part of a register (
al,ax) is treated as writing the whole register. - Arithmetic on fractions is followed only for the simplest cases. Vector instructions appear as
__asm. - Signed and unsigned comparisons look the same.
- A
switchis only recognised when the compiler built it as a jump table and the table can be read (see Switches). Small switches become chains ofifs, exactly as the compiler wrote them. Case values sometimes count from 0 when the original started elsewhere: when the program subtracts first (x - 1), the subtraction is put back only ifxis an argument. - Functions over 4,000 instructions are not converted. You get a message instead.
When the C view and the assembly disagree, the assembly is right.
Ask AI
Section titled “Ask AI”The Ask AI tab gets help from a language model running on your own PC, through LM Studio. Nothing is sent over the internet, it costs nothing, and it works offline.
- Explain this function: a plain-English walk-through: what the function does overall, the steps it takes, and anything worth a reverse engineer’s attention.
- Give me a hint: for crackmes. The first hint says where to look, the second what that part does, the third the method to solve it. None of them gives the answer itself: the last step is yours. Try on your own first.
- Answers appear as they are written. Stop cancels; Clear forgets the answers for this function.
- Let it think first: some models (Qwen 3.5, for example) can reason step by step before answering. It is off by default, because on a laptop that reasoning can take minutes: explaining a small function took about 3 seconds without it and over 2 minutes with it on a 4-billion-parameter model, and the answers were about as good. Tick it for a hard function; while the model reasons, the tab shows how many words of reasoning it has written so far.
- What was sent to the model last shows exactly what the model saw: the function’s C (with your renames, and Ghidra’s C too if you ran Ghidra), the functions it calls, and its assembly when it is short. Long assembly is left out, and the answer says so, because small models can only read a few thousand words at once.
Setting it up (free):
- Install LM Studio from lmstudio.ai.
- In LM Studio, download a chat model. A “Coder” or “Instruct” model of about 7 billion parameters (a download of around 5 GB) runs well on a laptop graphics card with 6 GB of memory. Bigger models are better but slower.
- Load the model, then on the Developer tab turn on the server.
- In Karak Studio, open Ask AI and press Check again. The model appears in the Model list.
Karak Studio talks to http://127.0.0.1:1234, LM Studio’s usual address. Any server that speaks the same “chat completions” format works too, such as Ollama (http://127.0.0.1:11434) or llama.cpp’s server: type its address in the Server box.
Small local models make mistakes, sometimes confidently. Treat an answer like a classmate’s suggestion and check it against the assembly. They are best at summarising readable C and weakest at raw assembly and tricky arithmetic.
C from Ghidra
Section titled “C from Ghidra”If Ghidra is installed on your PC, the C view can show Ghidra’s C as well as Karak Studio’s own. Ghidra is the free reverse engineering tool made by the NSA, and its decompiler is one of the best there is. Karak Studio contains none of Ghidra: it asks your installed copy to do the work.
Next to the function’s name, whenever the C view is on screen (its own tab, or beside the assembly in the Split view look), are two buttons, Karak and Ghidra. When Ghidra is installed, the C view shows Ghidra’s C unless you press Karak; Karak Studio remembers which you pressed last. With Ghidra’s C:
- Karak Studio starts Ghidra in the background on the open file. Loading takes about 10 to 30 seconds (longer for big programs). After that, every function you open gets Ghidra’s C in about a second.
- Meanwhile Ghidra analyses the whole program (under a minute for small programs, a couple of minutes for Notepad). Until it finishes, the C is marked Quick C: it is rougher (fewer names, no strings,
undefinedtypes). When the analysis finishes, the C view updates by itself to Ghidra’s best C. - Ghidra keeps running while the file is open, so moving between functions stays fast. Stop Ghidra closes it to free memory (Java uses about a gigabyte); it also closes when you open another file or quit.
- Ghidra’s best C is saved for each function you looked at, so next time it shows at once, without starting Ghidra. Run again throws the saved C for this file away.
- Everything runs on your PC. Nothing is sent anywhere.
- Clicking a line of Ghidra’s C selects the instruction it came from, as with Karak’s C.
- You can rename in Ghidra’s C too. Click a name Ghidra made up (
param_1,local_100,iVar1,puVar3,auStack_198,in_RAXand the like), then press F2 or the Rename button that appears. Every place it appears in the function changes, and the name is saved with your notes. These names are separate from your names in Karak’s C, because the two decompilers name things differently. - Function names work both ways. Functions you renamed show under your name in Ghidra’s C (
thunk_in front for the one-jump stubs that lead to them). Click aFUN_...name in Ghidra’s C and press F2 to rename that function everywhere in Karak Studio. Double-click it to go to it. - When Ghidra finishes analysing, it tells Karak Studio every function it found. The ones Karak Studio had missed are added to the Functions list, with · Ghidra after their address, and the status line says how many. Often these are functions the program only reaches through a table of addresses (for example a C++ object’s methods), never by a direct call, so they have no Called from. Ghidra also recognises common library functions by their code, so some arrive with real names such as
__scrt_common_main_seh. The list is saved with Ghidra’s C, so next time they are there as soon as the file opens. - For a file Karak Studio unpacked (UPX), Ghidra sees the packed file on disk, so its C is of the unpacking code. The panel says so.
Why Ghidra itself has to run: Ghidra’s decompiler is a separate program (decompile.exe), but it does not read machine code. For every instruction it asks Ghidra’s Java side for the instruction’s meaning in Ghidra’s own simple language, p-code. So Karak Studio runs Ghidra and asks it, one function at a time.
What you need: Ghidra (any recent version; the newest one found is used) and Java 21 or newer, which Ghidra itself needs. Karak Studio looks for a ghidra_... folder in C:\Program Files\Ghidra, C:\Program Files, your user folder, Downloads, Desktop and C:\, or in the folder named by the GHIDRA_INSTALL_DIR environment variable. If it finds none, the Ghidra button explains what to install.
Debug builds from Visual Studio call every function through a one-line stub, jmp function, kept in a table at the start of the code. Karak Studio lists those stubs as j_ plus the name of the function they lead to (as IDA does), and counts a call to a stub as a call to the function itself, so Called from shows the real callers.
Comparing the two side by side is a good way to learn: where they agree you can be fairly sure, and where they differ, the assembly settles it.
The function drawn as boxes joined by arrows. Each box is a stretch of code with no jumps into or out of its middle.
| Arrow | Meaning |
|---|---|
| Green | The path taken when a condition is true |
| Red | The path taken when it is false |
| Grey | A path that is always taken |
| Running up the left side | A jump backwards, which means a loop |
Shapes worth recognising:
| Shape | What it was in the source |
|---|---|
| One box splitting into two that join again | if / else |
| A split where one side goes straight to the join | if with no else |
| An arrow going back up | A loop |
| A column of boxes each with a side exit to the same place | A series of checks that must all pass |
| One box fanning out to a whole row of boxes | A switch built as a jump table, one arrow per case |
What you can do:
- Scroll with the mouse wheel, or hold Shift to scroll sideways.
- Click a box to select its first instruction.
- Double-click a box to see it in the Assembly view.
Boxes show up to 28 lines; longer ones end with “… N more lines”. Functions with more than 600 boxes are not drawn.
The raw bytes of the file, sixteen to a row.
140030800 68 74 74 70 3A 2F 2F 65 78 61 6D 70 6C 65 00 00 http://example..- The address on the left is where the first byte of the row lives.
- The middle shows each byte as two hex digits. Zero bytes are dimmed. The bytes of the instruction you have selected are highlighted.
- The right shows the same bytes as text, with a dot for anything that is not a printable character.
A dropdown at the top chooses which section to show. The Hex view opens by itself when you go to an address that is data and not code.
Very large sections show only their first 12 MB.
Two trees side by side.
- This function calls: everything the current function calls. Click an arrow to open one and see what it calls, and so on down. Names in green are Windows functions and cannot be opened.
- Who calls this function: every function that calls the current one. Open an arrow to see who calls the caller.
Each opened entry has an Open this function link. The trees go up to eight levels deep.
Use the first tree to understand what a function is built from, and the second to find out why it runs.