> For the complete documentation index, see [llms.txt](https://docs.hex-rays.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hex-rays.com/ida-9.5/core/decompiler/get-started.md).

# Getting started

This quick primer walks through a minimal, hands-on example to show how small amounts of type information can dramatically improve decompiler output.

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

![](https://492083732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFP6ibt8r6WPBHTqekG9u%2Fuploads%2Fgit-blob-3c1c09ba3cd492970f3e948169f4af52adf15fd3%2Fprimer1.gif?alt=media)

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

![](https://492083732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFP6ibt8r6WPBHTqekG9u%2Fuploads%2Fgit-blob-d5e8ee421681d59cc170139e2a6d5d40eee927b1%2Fprimer2.gif?alt=media)

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:

![](https://492083732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFP6ibt8r6WPBHTqekG9u%2Fuploads%2Fgit-blob-58426cde9e7156368dec7766bee02a3a57c3f028%2Fprimer3.gif?alt=media)

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**:

![](https://492083732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFP6ibt8r6WPBHTqekG9u%2Fuploads%2Fgit-blob-33bde98e6ed933f100018a1836a2ad404b395477%2Fprimer4.gif?alt=media)

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

![](https://492083732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFP6ibt8r6WPBHTqekG9u%2Fuploads%2Fgit-blob-f07589cae0c84695def1a270ee3d792d66b9d932%2Fprimer5.gif?alt=media)

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. Here is how we specify the type of the function pointer field:

![](https://492083732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFP6ibt8r6WPBHTqekG9u%2Fuploads%2Fgit-blob-7db9fabed329f607aaf291ef862b1e0f82ed8080%2Fprimer6.gif?alt=media)

The final result looks like this:

![](https://492083732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFP6ibt8r6WPBHTqekG9u%2Fuploads%2Fgit-blob-b4fc765cff21af9dc0c449bc79807cebaba8ae03%2Fprimer7.gif?alt=media)

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hex-rays.com/ida-9.5/core/decompiler/get-started.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
