# Quick primer

Let's start with a very short and simple function:

![](/files/kompUZi9wZHLueWhz7CC)

We decompile it with **View, Open subviews, Pseudocode** (hotkey **F5**):

![](/files/6nLTArQL9cwnqWNNSXTx)

While the generated C code makes sense, it is not pretty. There are many cast operations cluttering the text. The reason is that the decompiler does not perform the type recovery yet. Apparently, the **a1** argument points to a structure but the decompiler missed it. Let us add some type information to the database and see what happens. For that we will open the **Local Types** window (**Shift-F1**) and add a new structure type:

![](/files/gpoaNrw1l68coXTN5o2E)

After that, we switch back to the pseudocode window and specify the type of **a1**. We can do it by positioning the cursor on any occurrence of **a1** and pressing **Y**:

![](/files/BTlRjxwLraX4XhvQ5GlO)

When we press **Enter**, the decompilation output becomes much better:

![](/files/XMPZY5Z1nKUGBkxjmBpB)

But there is some room for improvement. We could rename the structure fields and specify their types. For example, **field\_6B1** seems to be used as a counter and **field\_6B5** is obviously a function pointer. We can do all this without switching windows now. [Only the initial structure definition required the **Local Types** window](#user-content-fn-1)[^1]. Here is how we specify the type of the function pointer field:

![](/files/UNfklRfBgW07IHs54sE4)

The final result looks like this:

![](/files/Ne3opoktmeinDOKn7fZf)

Please note that there are no cast operations in the text and overall it looks much better than the initial version.

[^1]: This is not completely true. In fact, we could enter the full structure definition in the type dialog box, but it is difficult because the input field consists of a single line. We could also define new types with the **File, Load file, Parse C header file** command.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hex-rays.com/9.1/user-guide/decompiler/primer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
